$_GET[] is used to get value from other file. Example is shows bellow
I created 1st file with name : form.html
<form action="index.php" method="get"> <!--Action is used to sand data to "index.php" file-->
<!--
##################################################
# Table is used to align data with certain order #
##################################################
-->
<table>
<tr><td><label for="FName">Type Your 1st Name:</label></td><td><input type="text" name="FName" placeholder="Type 1st Name" /></td></tr> <!--name attribute is used to get value at index.php-->
<tr><td><label for="LName">Type Your 1st Name:</label></td><td><input type="text" name="LName" placeholder="Type Last Name" /></td></tr> <!--placeholder is used to show guidance -->
<tr><td><label for="Number">Type Your 1st Name:</label></td><td><input type="text" name="Number" placeholder="Type your number" maxlength="10" /></td></tr>
<tr><td> </td><td align="left"><input type="submit" value="submit" /></td></tr> <!-- is used to add spance-->
</table>
</form>
Note : form.html was separate file and data is sent to index.phpNow I created 2nd file with name : index.php
<?php
$fname = $_GET[FName]; // Here I got 1st name data
$lname = $_GET[LName]; # Here I got Last name data
$number = $_GET[Number]; /* Here I got number data */
//---------------------------------------------------------//
// I used different Comments styles above to remind them //
// I used different Variables styles bellow to remind them //
//---------------------------------------------------------//
echo "User First Name is : {$fname} <br />"; # Variable with curly brackets within double qoutes
echo "User Last Name is : $lname <br />"; # Variable without curly brackets within double qoutes
echo "User Number is : " . $number # Variable with dot operator
?>
Here I got URL as :
http://www.qwc.me/index.php?FName=Samee+Ullah&LName=Feroz&Number=3234223945
Now try to understand this line
FName=Samee+Ullah&LName=Feroz&Number=3234223945
Here you need to understand 3 things
after URL :
- http://www.qwc.me/index.php = URL Main Part
- ? = Question Mark
- FName=Samee+Ullah = Value
this value is sent to index.php
Post a Comment
Give your reviews about this blog. Leave your comments. what do you think about this post?
Comments Description is given below:
1) I love to read comments, but do not spam.
2) Like this blog and also tweet its posts.
3) You can use some xHTML tags.
4) All Comments are Do Follow, Please try to use blog professionally.
5) Mention Your Name below the comment.
6) You can also suggest for improvement.
7) Do not forget to subscribe Samee Articles blog.
---------------------------------------
Thanks for visiting QWC.Me.
==========================================
For free guidelines contact me on SEO Expert | Samee Ullah Feroz is online there.
==========================================
Best Regards