Internet Applications: PHP Arrays, HTML Forms
Internet Applications: PHP Arrays, HTML Forms
<?php
echo '$_GET value is: ';
print_r($_GET);
echo "<br>";
echo '$_POST value is:';
print_r($_POST);
?>
HTML Forms: A simple example
<form action="" method="post" id="numbers">
<p> Enter Your name: <input type = “text” name =
“my_name”> <p>
<?php
echo '$_GET value is: ';
print_r($_GET);
echo "<br>";
echo '$_POST value is:';
print_r($_POST);
?>
HTML Forms: A simple example (2)
<form action="" method=“get" id="numbers">
<p> Enter Your name: <input type = “text” name =
“my_name”> <p>
<?php
echo '$_GET value is: ';
print_r($_GET);
echo "<br>";
echo '$_POST value is:';
print_r($_POST);
?>
HTML Forms: A simple example (3)
<form action="" method="post" id="numbers">
<p> Enter Your name: <input type = “text” name =
“my_name”> <p>
<?php
echo '$_GET value is: ';
print_r($_GET);
echo "<br>";
echo '$_POST value is:';
print_r($_POST);
?>
HTML Form Controls
• Different type of form controls use to collect data using HTML form
• Text Input Controls
• Hidden Controls
• Submit and Reset Button
• Checkboxes Controls
• Radio Box Controls
• Select Box Controls
• File Select boxes
• Clickable Buttons
Courtesy: https://www.tutorialspoint.com/html/html_forms.htm
</form>
</form>
</form>
}
?>
}
?>
MA 518: Database Management Systems 32
Processing POST data
…………..
</form>
<?php
if (isset($_POST['first_num']) && isset($_POST['second_num']) && isset($_POST['operator'])) {
$first_num=$_POST['first_num'];
$second_num=$_POST['second_num'];
$operator=$_POST['operator']; $result = '‘”;
if (is_numeric($first_num) && is_numeric($second_num)) {
switch ($operator) {
} }
}
?>
MA 518: Database Management Systems 33
Processing POST data
…………..
</form>
<?php
if (isset($_POST['first_num']) && isset($_POST['second_num']) && isset($_POST['operator'])) {
$first_num=$_POST['first_num'];
$second_num=$_POST['second_num'];
$operator=$_POST['operator']; $result = '‘”;
if (is_numeric($first_num) && is_numeric($second_num)) {
switch ($operator) {
case "Add":
$result = $first_num + $second_num;
break;
} }
echo "Result:<input type='text' value=$result />";
}
?> MA 518: Database Management Systems 34
Processing POST data
…………..
</form>
<?php
if (isset($_POST['first_num']) && isset($_POST['second_num']) && isset($_POST['operator'])) {
$first_num=$_POST['first_num'];
$second_num=$_POST['second_num'];
$operator=$_POST['operator']; $result = '‘”;
if (is_numeric($first_num) && is_numeric($second_num)) {
switch ($operator) {
case "Add":
$result = $first_num + $second_num;
break;
case "Subtract":
$result = $first_num - $second_num;
break;
……………………
} }
echo "Result:<input type='text' value=$result />";
}
?> MA 518: Database Management Systems 35
Thank You