Forum Moderators: coopster

Message Too Old, No Replies

Displaying form element

Displaying form input on the screen

         

Adam5000

3:56 pm on Sep 22, 2010 (gmt 0)

10+ Year Member



I'm trying to display the contents of a form field on the screen using PHP. But I'm not having any luck. Below is the code I've got so far.

Help!

<html>
<head>
<title>Test</title>
</head>

<body>

<form>

<input type="text" name="u_name">
<input type="submit" value="Click here to test.">

</form>

<?php
echo $_POST["u_name"]
?>

</body>
</html>

optik

6:02 pm on Sep 22, 2010 (gmt 0)

10+ Year Member



A couple of things your form has no attributes e.g <form action="index.html" method="post">

and you need to end the echo with an ;

Matthew1980

7:52 pm on Sep 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Adam5000,

A good thing to have enabled when testing is error_reporting(E_ALL); with this as the first line after the <?php tags you should have all erroneous code picked up and displayed as error's and/or warnings.

Cheers,
MRb