The method of page post back is quite easy concept it trip back on the page on which our code has been placed or in another terms we can say page call itself for further operation.
Simple example of PHP post back :
<?php
/*
php code for handling post back.
*/
if(isset($_POST['submit']))
{
$first = $_POST['fname'];
$last = $_POST['lname'];
echo "Full nmae : ".$first." ".$last;
}
?>
<html>
<head><title>Handling post back in PHP</title></head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post" name="form">
<center>
<table>
<tr>
<td>first name</td><td><input type="text" name="fname" /></td>
<tr><td>last name</td><td><input type="text" name="lname" /></td></tr>
<tr><td> </td><td><input type="submit" name="submit" value="go.."</td></tr>
</tr>
</table>
</center>
,</form>
</body>
</html >
this simple program defining PHP post back as by checking in the starting of the program for posted array variable submit if it got it setted then the further script will execute .
Another simple example on PHP post back with checkbox input :
<?php
if(isset($_POST['submit']))
{
$firstdigit = $_POST['fdigit'];
$lastdigit = $_POST['ldigit'];
if(isset($_POST['add']))
{
$sum = $firstdigit + $lastdigit ;
}
if(isset($_POST['mul']))
}
?>
<html>
<head>
<title>PHP post back</title>
</head>
<body>
<table>
<tr>
<td>First digit</td><td><input type="text" name="fdigit" /></td>
</tr>
<tr>
<td>Second digit</td><td><input type="text" name="sdigit" /></td>
</tr>
<tr>
<td> </td><td>Add<input type="checkbox" name="add" <?php if(isset($_POST['add'])) echo "checked"; ?> />Multiply<input type="checkbox" name="mul" <?php if(isset($_POST['mul'])) echo "checked"; ?> /></td>
</tr>
<tr><td> </td><td><input type="submit" name="submit" value="process" /></td></tr>
<tr>
<td>Results</td>
<td> </td>
</tr>
</table>
</body>
</html>
Simple example of PHP post back :
<?php
/*
php code for handling post back.
*/
if(isset($_POST['submit']))
{
$first = $_POST['fname'];
$last = $_POST['lname'];
echo "Full nmae : ".$first." ".$last;
}
?>
<html>
<head><title>Handling post back in PHP</title></head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post" name="form">
<center>
<table>
<tr>
<td>first name</td><td><input type="text" name="fname" /></td>
<tr><td>last name</td><td><input type="text" name="lname" /></td></tr>
<tr><td> </td><td><input type="submit" name="submit" value="go.."</td></tr>
</tr>
</table>
</center>
,</form>
</body>
</html >
this simple program defining PHP post back as by checking in the starting of the program for posted array variable submit if it got it setted then the further script will execute .
Another simple example on PHP post back with checkbox input :
<?php
if(isset($_POST['submit']))
{
$firstdigit = $_POST['fdigit'];
$lastdigit = $_POST['ldigit'];
if(isset($_POST['add']))
{
$sum = $firstdigit + $lastdigit ;
}
if(isset($_POST['mul']))
{
$multi = $firstdigit * $lastdigit ;
}
}
?>
<html>
<head>
<title>PHP post back</title>
</head>
<body>
<table>
<tr>
<td>First digit</td><td><input type="text" name="fdigit" /></td>
</tr>
<tr>
<td>Second digit</td><td><input type="text" name="sdigit" /></td>
</tr>
<tr>
<td> </td><td>Add<input type="checkbox" name="add" <?php if(isset($_POST['add'])) echo "checked"; ?> />Multiply<input type="checkbox" name="mul" <?php if(isset($_POST['mul'])) echo "checked"; ?> /></td>
</tr>
<tr><td> </td><td><input type="submit" name="submit" value="process" /></td></tr>
<tr>
<td>Results</td>
<td> </td>
</tr>
<tr>
<td>Addition</td>
<td><?php if(isset($sum)) echo $sum; ?></td>
</tr>
<tr>
<td>Multipliaction</td>
<td><?php if(isset($multi)) echo $multi; ?></td>
</tr>
</table>
</body>
</html>
please post webservies
ReplyDeletethanks for example of query string
ReplyDeleteit was helpful and very clear thanks.what if i have a drop down list for example "user selects the country" do i need to do the same
ReplyDeleteNice Blog.... I'm trying this code but there is a problem i have that when i send the data (post) to database and refresh the page then automatically the data is again goes to the database without my sending.
ReplyDeleteplease someone help me
ReplyDeleteYour good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
microsoft azure training in bangalore
rpa training in bangalore
best rpa training in bangalore
rpa online training
We are a group of volunteers and starting a new initiative in a community. Your blog provided us valuable information to work on.You have done a marvellous job!
ReplyDeleteAWS training in sholinganallur
AWS training in Tambaram
AWS training in Velachery
This comment has been removed by the author.
ReplyDeleteinstagram takipçi satın al
ReplyDeleteinstagram takipçi satın al
takipçi satın al
takipçi satın al
instagram takipçi satın al
takipçi satın al
instagram takipçi satın al
thanks admin good post HDE Bilişim
ReplyDeleteAlışveriş
Compo Expert
Multitek
Seokoloji
Vezir Sosyal Medya
Adak
Maltepe Adak
This post is so interactive and informative.keep update more information...
ReplyDeleteIELTS Coaching in Tambaram
IELTS Coaching in Chennai
Such a good post .thanks for sharing
ReplyDeleteSpoken english classes in t nagar
Spoken English Classes in Chennai
Great post. keep sharing such a worthy information.
ReplyDeleteSEO Training in Chennai
SEO Course
This post is so useful and informative. Keep updating with more information.....
ReplyDeleteFuture Of Cyber Security
Cyber Security Techniques
perde modelleri
ReplyDeleteNUMARA ONAY
Vodafone Mobil Ödeme Bozdurma
nft nasıl alınır
Ankara evden eve nakliyat
Trafik sigortası
Dedektör
Websitesi Kurmak
aşk kitapları