Write PHP program accept name, select your cities you would like to visit (Use multi-valued parameter), and display selected information on page.||EasyCoding45

 In this Tutorial we are going to learn how we can Write a PHP program accept name, select your cities you would like to visit (Use multi-valued parameter), and we can display selected information on page.


Program:-(save as .php extension)


<html>

<title>multi value parameter</title>

<body>

<form method=get action="">

Enter name :<input type=text name=t1 value="<?php if(isset($_GET['t1'])) echo $_GET['t1'];?>"><br>

select Your Cities :

<select name=cities >

<option value=pune>Pune</option>

<option value=Mumbai>Mumbai</option>

<option value=Kolhapur>Kolhapur</option>

<option value=Pimpri>Pimpri</option>

<option value=Thane>Thane</option>

</select>

<br>

<input type=submit value=submit><br>

</form>

</body>

</html>

<?php

$city=$_GET['cities'];

$name=$_GET['t1'];

if(isset($city,$name))

{

if($city==""||$name=="")

{

echo "you Selected Nothing ";

}

else

{

echo "Your Name :$name<br>";

echo "and You want to visit $city ";

}

}

?>



OutPut :-


                            

Comments