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
Write a program to find a string is palindrome or not?
What is smarty?
How to get the directory name out of a file path name?
Which is the latest version of php?
Explain what are psrs? Choose 1 and briefly describe it?
What are the differences between PHP3 and PHP4 and PHP5? what is the current stable version of PHP?
How to connect to a url in php?
What is the difference between static and dynamic websites?
How to create database connection and query in php?
Why do you need to filter out empty files?
Is php front end or back end?
What is better .net or php?
How does php sessions work?
How we can retrieve the data in the result set of mysql using php?
What is the use of $_request variable?