How do i transform URL variable into normal? PHP?

Saulius

New member
So lets say i have url mywebsite.com/page.php?Special+text


What code do I need to print out that text on my page? I guess it should be function that reads url and creates the variable which then I can echo, anyone can help?
 
Hey,

If you want to pass a variable to a page using php you would make use of the get function.

Usually you would start with a form with method GET. For example if you wanted a page to display a name.
page1.php would consist of:

<form action="page2.php" method="get">
<input type="text" name="name" value="" />
<input type="submit" name="submit" value="submit" />
</form>

page2.php would then have:

<?php

$name = $_GET['name'];
echo "Welcome " . $name;

?>

Hope this helps. Any quesitons just ask :)
 
Back
Top