Forum Moderators: coopster

Message Too Old, No Replies

What needs changing for php5

         

wheelie34

10:50 am on Jun 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This code works fine in php4

<?php
print "Your name is $Name";
print "<br />";
print "You are $Age years old";
print "<br />";
$old = 25 + $Age;
print "In 25 years you will be " . $old . " years old";
?>
<html>
<head><title>Test Page</title></head>
<body>
<h2>Data Collection</h2><p>
<form method="post">
<table>
<tr><td>Name:</td><td><input type="text" name="Name"></td></tr>
<tr><td>Age:</td><td><input type="text" name="Age"></td></tr>
<tr><td colspan="2" align="center"><input type="submit"></td></tr>
</table>
</form>
</body>
</html>

But does nothing in php5, I have not used php5 before and have no idea what is wrong with the above.

It started out as a quick php post to self test, now cant work out whats wrong please help, thanks

colandy

11:16 am on Jun 22, 2007 (gmt 0)

10+ Year Member



Do The Following:

print "Your name is ".$_POST['Name'];

and so on. This should work in 4 and 5.

wheelie34

11:51 am on Jun 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



cheers it works fine now

jatar_k

12:46 pm on Jun 22, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



so the only thing that is different wheelie34 is that register_globals is now off, which is much more secure anyway.

you can look at this
Using Register Globals [php.net]

wheelie34

2:42 pm on Jun 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks jatar_k for adding that, just when I thought I had mastered "what I needed to know" with php, I get a client on a php5 server, great!

jatar_k

2:46 pm on Jun 22, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



it will work out better in the long run anyway, register_globals is always off by default now and any clients that have it on should be smacked, sorry I mean educated, and turn it off.