|
get variables
|
|
|
method="get"
|
not submit to another , used to display to customers
|
|
<?php
|
|
|
echo $_GET| 'year'|;
|
whenever u submit, it will print the data entered in the
respective elements like year we used in this
|
|
?>
|
|
|
<form action = "index.php" method
="GET">
|
|
|
Day: <br> <input type="text"
name="day" > <br> <br>
|
|
|
month: <br> <input type="text"
name="month" > <br> <br>
|
|
|
year: <br> <input type="text"
name="year" > <br> <br>
|
|
|
<input type ="submit" value="submit">
|
|
|
</form>
|
|
|
is submit entered
|
|
|
<?php
|
|
|
if (isset( $_GET|'DAY'|)&& isset( $_GET|'MONTH'|)
&& isset( $_GET|'YEAR'|) ) {
|
|
|
echo 'ok';
|
|
|
}
|
|
|
?>
|
|
|
check all fields entered , if entered go to one side, if not go to
another side
|
|
|
<?php
|
|
|
if (isset( $_GET|'DAY'|)&& isset( $_GET|'MONTH'|)
&& isset( $_GET|'YEAR'|) ) {
|
isset(true ) it will execute insidestatement- get the day into
day varaible and get the data into month like that
|
|
$day = $ GET['DAY'];
|
|
|
$month = $ GET['MONTH'];
|
|
|
$year = $ GET['YEAR'];
|
|
|
if(!empty ($day) && !empty ($month) && !empty
($year) ){
|
day is not equal to empty
then preint ok , if equal to empty
|
|
echo 'ok';
|
means if u not enteres any cell, it tells ple fil al fields
|
|
}else {
|
eventhough u n ot enetrs
|
|
echo ' <> filll in all the fields .';
|
|
|
}
|
|
|
}
|
|
|
?>
|
|
|
draw backs of get - if the form length is too much, then url
shown as large
|
|
|
if password is entered- if it shows in url, its also a negative
|
|
|
how to verify the data entererd in input elements boxes, and all
are entered execute on statement or
show their entered data
|
|
|
post variables -index.php
|
|
|
<?php
|
|
|
if (isset( $_POST|'DAY'|)&& isset( $_POST|'MONTH'|)
&& isset( $_POST|'YEAR'|) ) {
|
IS SET IS MEANS IT IS SUBMITTED OR NOT
|
|
$day = $_POST['DAY'];
|
|
|
$month = $_POST['MONTH'];
|
|
|
$year = $_POST['YEAR'];
|
|
|
if(!empty ($day) && !empty ($month) && !empty
($year) ){
|
|
|
echo 'ok';
|
|
|
}else {
|
|
|
echo ' <> filll in all the fields .';
|
|
|
}
|
|
|
}
|
|
|
?>
|
|
|
<form action = "index.php" method
="POST">
|
|
|
Day: <br> <input type="text"
name="day" > <br> <br>
|
|
|
month: <br> <input type="text"
name="month" > <br> <br>
|
|
|
year: <br> <input type="text"
name="year" > <br> <br>
|
|
|
<input type ="submit" value="submit">
|
it prints ist php and form next
|
|
</form>
|
|
|
how to print the data what customer entererd
|
|
|
<?php
|
|
|
if (isset( $_POST|'DAY'|)&& isset( $_POST|'MONTH'|)
&& isset( $_POST|'YEAR'|) ) {
|
|
|
$day = $_POST['DAY'];
|
|
|
$month = $_POST['MONTH'];
|
|
|
$year = $_POST['YEAR'];
|
|
|
if(!empty ($day) && !empty ($month) && !empty
($year) ){
|
|
|
ECHO '<h2> username: '[. $day . '</h2>';
|
|
|
ECHO '<h2> month: '[. $month . '</h2>';
|
|
|
ECHO '<h2> year: '[. $year . '</h2>';
|
|
|
}
|
|
|
}
|
|
|
?>
|
|
| get method | ||||||||||||
| form page | ||||||||||||
| isset | ||||||||||||
| $get_(day | ||||||||||||
| isset | ||||||||||||
| $get_(day | ||||||||||||
| !empty($day) | ||||||||||||
| isset | ||||||||||||
| $_post[] | ||||||||||||
| if else | ||||||||||||
| action | ||||||||||||
| form | ||||||||||||
| name | ||||||||||||
| isset | ||||||||||||
| $_post[] | ||||||||||||
| !empty($day) | ||||||||||||
|
No comments:
Post a Comment