PHP Notes By Kshitij :: PART 7

 

Form in PHP (Registration.php)

<html>

<head>

<title>Registration Form</title>

</head>

 

<body>

<form action=”process.php” method=”get”>

<table border=”2px” align=”center”>

<tr>

<th>User Name</th>

<td><input type=”text” name=”uname”/></td>

</tr>

<tr>

<th>Password</th>

<td><input type=”password” name=”password”/></td>

</tr>

<tr>

<th>Address</th>

<td><textarea name=”address”></textarea></td>

</tr>

<tr>

<th>City</th>

<td>

<select name=”city”>

<option value=””>— Select City —</option>

<option value=”Ajmer”>Ajmer</option>

<option value=”Jaipur”>Jaipur</option>

<option value=”Kota”>Kota</option>

<option value=”Bikaner”>Bikaner</option>

</select>

</td>

</tr>

<tr>

<th>Gender</th>

<td>

<input type=”radio” name=”gender” value=”Male”/>Male

<input type=”radio” name=”gender” value=”Female”/>Female

</td>

</tr>

<tr>

<th>Course</th>

<td>

<select name=”course[]” multiple>

<option value=”HTML”>HTML</option>

<option value=”CSS”>CSS</option>

<option value=”PHP”>PHP</option>

<option value=”Java”>Java</option>

<option value=”Salesforce”>Salesforce</option>

</select>

</td>

</tr>

<tr>

<th>Hobbies</th>

<td>

<input type=”checkbox” name=”hobbies[]” value=”Singing”/>Singing

<input type=”checkbox” name=”hobbies[]” value=”Reading”/>Reading

<input type=”checkbox” name=”hobbies[]” value=”Surfing”/>Surfing

</td>

</tr>

<tr>

<td><input type=”submit” value=”Submit Form”/></td>

<td><input type=”reset” value=”Refresh Form”/></td>

</tr>

</table>

</form>

</body>

</html>

 

 

 

 

 

 

 

 

 

 

 

 

Form in PHP (Process.php)

<?php

error_reporting(0);

//$name = $_GET[‘uname’];

//$password = $_POST[‘uname’];

$name = $_REQUEST[‘uname’];

$password = $_REQUEST[‘password’];

$address = $_REQUEST[‘address’];

$city = $_REQUEST[‘city’];

$gender = $_REQUEST[‘gender’];

$cr = $_REQUEST[‘course’];

$course = implode(“,”,$cr);

$hobbies = implode(“,”, $_REQUEST[‘hobbies’]);

?>

<table border=”2px” align=”center”>

<tr><th>User Name</th><td><?= $name ?></td></tr>

<tr><th>Password</th><td><?= $password ?></td></tr>

<tr><th>Address</th><td><?= $address ?></td></tr>

<tr><th>City</th><td><?= $city ?></td></tr>

<tr><th>Gender</th><td><?= $gender ?></td></tr>

<tr><th>Course</th><td><?= $course ?></td></tr>

<tr><th>Hobbies</th><td><?= $hobbies ?></td></tr>

<tr>

<td colspan=”2″ align=”right”>

<a href=”registration.php?nm=<?= $name ?>&add = <?= $address ?>”>Edit Information</a>

</td>

</tr>

</table>

 

Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *