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

Does php has a future?

0 Answers  


Which is better #define or enum?

0 Answers  


Define metaphone()?

0 Answers  


How to read a file in binary mode?

0 Answers  


So if md5() generates the most secure hash, why would you ever use the less secure crc32() and sha1()?

0 Answers  






How to include a file to a PHP page?

0 Answers  


How long is csrf token?

0 Answers  


List out some tools through which we can draw E-R diagrams for mysql?

6 Answers  


what the new feature add in php 7.2?

0 Answers  


How to use http headers inside php?

0 Answers  


Suppose a variable may passed to other page using any of get,post,session,cookie methods and u want to retrive that variable value . what is the syntax?

6 Answers  


What is the ioncube php loader?

0 Answers  


Categories