Jump to content

name display problem


opicoder

Recommended Posts

Good afternoon,

 

You first want to check that the form has been submitted and that the $_POST superglobal actually contains a value. You should do this:

<?php
 
if(isset($_POST['fname']))
{
       //the $_POST superglobal holds value(s)!
 
 
}
else
{
      //we got nothing.
}
 
 
?>

That will eliminate your Undefined Index problem.
 
Now, what are you typing in the fname field in the form?
 
It should display the value that you entered.
 
Kind regards,
 
L2c.
 

You should be getting the name from a form with an input field. You can default the value to Quest

<form method="POST" action="myscript.php">
<input name="fname" type="text" value="Quest">
<input type="submit>
</form>

If you don't want the user to be able to change the value easily use type="hidden" instead of text. If you don't want the user to control the value then don't put it in the $_POST array.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.