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.



Create a PHP web script with the following attributes: on start, three HTML form elements are show..

Answer / 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

More PHP Interview Questions

What is regular expression in javascript?

0 Answers  


hi,am a fresher in sap sd,will i try as a fresher or i wl go for with 2 to 3 yr exp,pls suggest me which web site is best for sap freshers.

0 Answers  


What are session variables in php?

0 Answers  


Is php easier than javascript?

0 Answers  


What are getters and setters php?

0 Answers  


Who is the father or inventor of php?

0 Answers  


What is difference between $x and $$x

5 Answers   Mindex, Net Solution, Procon IT Solutions, Trigent,


equivalent code for the following c program in php void main() { int i=5;printf("%d",i); }

2 Answers  


What is form action php?

0 Answers  


What are the main error types in php?

0 Answers  


Which php framework is in demand?

0 Answers  


Write the statements that are used to connect php with mysql

0 Answers  


Categories