getting input from form and display to browser in php

admin

Administrator
Staff member
hi every body!
i have a problem on not displaying the user input on in browser

I use php 5.0.5 with apache 2.0.49 and studying php 4 from book
every thing from the first chapter worked fine but in chapter form it is not working

I have a form with user name and address that php should display to browser according to book.

html form

<html>
<head>
<title>applying form</title>
</head>
<body>
<form action="form.php" method="POST">
<input type="text" name="user">
<input type="text" name="address">
<input type="submit" value="click">
</form>
</body>
</html>

form.php

<?php
print "This is $user<br>";
print "this your address $address";
?>

according to the book of php 4 that i am studing it should dispaly what ever u entred in the html form to browser.

plz help me about getting input from user and displaying to browser. and tell me where is the problem with me.I know that these two mehtod work but i don't know that what ever the book given the above code in php 4 is not working. Is this method has been disabled in php5 ?
$_GET['userfile1'] or $_POST['userfile1'] will work but i want the method that the book has given.the book is old, i.e. php4 and is asuming that your "register_globals" parameter in php.ini file are switched on. This approach is no longer prefered and is insecure. the register_globals are now switched off by default.

your values will be accessible by $_POST['user'] and $_POST['address'] that is if the form is being POSTed. if you are using GET method in the form or simply accessing the file with e.g. index.php?user=me&address=somewhere

then you can access the request variables using $_GETFor more details, see Question One of the Newbies's forum FAQ.
 
Back
Top