This is an intro into php forms for beginners.
What's about this 2 functions? You can handle forms submits(you can't using just html)
First of all let's take an example:
<?phpThe example above is a get request, to use it type into browser filename.php?name=thecodertips
It will echo out 'thecodertips' into the browser.
What's different between get and post? Get can be shown into url and post not. Get method should not be used when submitting passwords.
<?phpHow to go with post now? There must be a form to submit the request:
<html>The php code handles the input of the text box with the name 'hi', note! "Box name(name=) should be always same with the post/get name([''])
<form action="" method="post">
<input type="text" name="hi">
action="" tells the browse to which file it should submit the data
method="" can be get or post
So far so good, but how to check if user submitted anything or not?
We can use isset, empty.
<?phpHope you liked this simple lesson on form handling.
// usage: empty, isset, !empty, !isset
echo 'your name is '.$_GET['name'];
echo 'enter your name';