[thelist] php: problem with variable

Jason Lustig lustig at acsu.buffalo.edu
Wed Jan 23 08:45:21 CST 2002


>So how
>would I go about doing this?

OK, try this...

In your form:

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

<!-- form -->
'
<input type="submit" name="submitted" value="submit this...">

</form>



...in your php code (this'll only work in 4.1.0+, because of the $_*
vars)...

<?php

if (!isset($_POST['submitted']))
{
	// print the form
} else {
	// fuss with the data
}

?>

... hope that helped. The reason you got undefined var errors is because
originally, when someone went ot the page and they hadn't submitted the form
yet, the variable $submit hadn't been set yet -- :. it was undefined.

--Jason





More information about the thelist mailing list