PHP Form Handling Submit

php form
PHP Form Handling Submit GET or POST is PHP Form used interactive user or customer send data information to server. Handling data at php form usualy two method as self page or different page.

To use the php web form you can follow the following examples

Exemple submit to $_SERVER['PHP_SELF'] page test.php

<html>
<head>
<title>form method</title>
</head>
<body>
<?php
if($_SERVER["REQUEST_METHOD"]=="POST"){
$country = $_POST["country"];
echo $country;
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table border="1" align="center">
<tr>
<td>Country</td>
<td>
<Selct name="country">
<option value="Honda">Honda</option>
<option value="Yamaha">Yamaha</option>
</select>
</td>
</tr>
</table">
</form>
</body>
</html>

Exemple submit to page form test.php and action page handle_test.php

 <html>
<head>
<title>form method</title>
</head>
<body>
<form method="post" action="handle_test.php">
<table border="1" align="center">
<tr>
<td>Country</td>
<td>
<Selct name="country">
<option value="Honda">Honda</option>
<option value="Yamaha">Yamaha</option>
</select>
</td>
</tr>
</table">
</form>
</body>
</html>

page action handle_test.php

<?php
if($_SERVER["REQUEST_METHOD"]=="POST"){
$country = $_POST["country"];
echo $country;
}
?>

Lebih baru Lebih lama

نموذج الاتصال