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 the difference between == and === in php?

0 Answers  


can anyone explain about stored procedure,Triggers and transaction in php?

2 Answers  


how to install openssl, ISAPI, pdf modules in php 5.2.5 with apache on windows xp.

2 Answers  


PHP can be used frontend of for backend?

3 Answers   Global Logic,


Is apache needed for php?

0 Answers  






What is MVC structure in Magento?

4 Answers  


Explain the different types of errors in php.

0 Answers  


What the difference between WAMP5 1.7.3 and WampServer 2?

3 Answers  


How to check a variable is array or not in php?

0 Answers  


I have two radio button, i click one radio button display one dropdown box, one text field. and then click another radio button display one text field.so any one give me good idea plz.....i used <div id="" style=display:none> but not work..

4 Answers  


Explain how to submit form without a submit button.

0 Answers  


What are the new features available in php 7?

0 Answers  


Categories