Jump to content

Form Troubles


JackJack

Recommended Posts

target your form to itself
set the value of the form elements to contain the respective variable

It's many ways of doing this, here is one example

[code]
$show_form = 1;

if(isset($_POST['submit']))
{
$show_form = 0;
$name = $_POST['name'];

if(empty($_POST['name']))
{
  print "Name is missing";
  $show_form = 1;
}
else
{
  // prossess posted name
}
}

if($show_form == 1)
{
echo <<<__HTML_END

<form action="this.php" method="post">

<input type="text" name="name" value="$name" maxlenght="30" />

<input type="submit" name="submit" value="Send Form" />

</form>

__HTML_END;
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/9642-form-troubles/#findComment-35656
Share on other sites

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.