Create a PHP web script with the following attributes: on
start, three HTML form elements are shown: an string input
field, a checkbox field, a dropdown/pull down list with 5
elements and a submit button. On submission, the form
should be redisplayed (while remaining all options/inputs
as the user has selected/entered them). Additionally, the
selections/inputs of the user should be displayed in text.
Please solve this without the use of any external
libraries.

Answer Posted / pankajbisane

This is the Script:

<?php
if (isset($_POST["submit"]))
{
$textBox = $_POST["textBox"];
$dropdown = $_POST["dropdown"];
$check = $_POST["check"];
echo "Form submitted.";
}
else
{
echo "Please submit form";
}
?>


<form name="frm" method="post" action="<?php
$_SERVER["PHP_SELF"]?>" >
<input type="text" name="textBox" value="<?php echo
$textBox ?>" /><br />
<input type="checkbox" name="check" value="1" <?php if
($check == "1") echo "checked" ?> /><br />
<select name="dropdown">
<option <?php if ($dropdown == "Pankaj") echo "selected";
?> >Pankaj</option>
<option <?php if ($dropdown == "Bisane") echo "selected";
?> >Bisane</option>
<option <?php if ($dropdown == "MCS") echo "selected"; ?>
>MCS</option>
</select><br /><br />
<input type="submit" name="submit" value= "Submit" /><br />
</from>

Is This Answer Correct ?    17 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Maine 12th ke bad 2 years ka web designing ka course kiya hai. Php me achcha hu. Ek fresher ko is field me kitna mil sakta hai ?

4981


When do you use define() and when do you use const. What are the main differences between those two?

778


What does $this do in php?

706


Tell me how the result set of mysql be handled in php?

670


Why do we use interface in php?

695


How to convert strings in hex format?

738


Which is better mysql or sql?

722


How to move uploaded files to permanent directory?

700


What is basic php?

711


What is cookie and why do we use it?

711


What is pdo in php why use?

656


What Is a Persistent Cookie?

777


How many ways to include array elements in double-quoted strings using php?

760


How does php serialize work?

685


Do you know how to declare an array in php?

701