Monday, February 21, 2005

Php without global vars

I was trying a simple form write in php. As usual, I try it in the old way, look for an example and then copy and paste... unsuccessfull ...
After become a little bit crazy I remember those changes done by php team around register globals in 4.2.0

I look around for a while, specially reading php documentation and I found very good examples and explanations.For example at register globals documentation page I found inspirer contributions. Now I offer you mine own code:
if ($_POST['submit']) {
...
$name = $_POST['name'];
...
echo "You say $name";
}else{
...
echo "<form>Nombre:<input type="text" name="name">
<input type=...>
</form>";
}

I hope it would help somebody...