FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!

Variables via POST with forms




Hello everybody, this is a new tutorial for learn how to make a form with variables, if you use the get metod in a form, as see on the "Variables" blog post, the form will return that variables in the URL, the "Post" method don´t display variables in the url, its like the GET method in the php:
Code:

<?php
if($_POST){///If the user send the form
$variable=$_POST['varname'];
echo $variable;
}
?>
<form method="POST">
<input type="text" name="varname" value="Enter a text"/>
<input type="submit" value="Send this and display!"/>
</form>

that will return the variable entered in the textbox, if you "Reload" the page, this can resend the form, but these var are not saveds, by the way, if you want to save these in a database, you can do it with mysqli, or mysql(Some servers don´t use mysqli, and you need to use mysql Brick wall )



2 blog comments below

Good to see PHP for beginners.
It will be useful for all newbies.

Why are you not posting it on Tutorial Section?
Because it easy to search on tutorial section if we want particular tutorial.
cybersa on Sat Oct 05, 2013 2:01 pm
Good idea, i´ll post all my tutorials (Only links for not be banned for spam...).
Phpaddict on Sun Oct 06, 2013 8:37 pm



FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.