NYCPHP Meetup

NYPHP.org

[nycphp-talk] Having a form return to itself after "submit"

leam at reuel.net leam at reuel.net
Sat Oct 9 21:24:15 EDT 2004


Thanks Henry, that did the trick. Well, it took me a bit to grasp; I'm easily lost on some things. But the form does work and resets it self *and* enters stuff into the database.

ciao!

leam

On Sat, Oct 09, 2004 at 05:34:40PM -0300, Henry Ponce wrote:
> Hello, you can do something similar to this.
> 
> I would use one form.
> ================================
> <?
> if (isset($_POST["insert_button"])){
> 	// 1. do all you need to insert to the database
> 	// 2. you can create messages that are contained in some variable.
> 	// for example $message
> }
> if (isset($message)){
> 	echo $message;
> }
> ?>
> <form name="insert_form" action="" method="post">
> <?
> // all the form elements
> ?>
> 	<input type="submit" name="insert_button" value="Insert">
> </form>
> ===============================================
> Basically, if $_POST["insert_button"] isn't set then this means that there is 
> no need to insert in the database, otherwise the form elements can be 
> inserted.
> 
> I hope you understand this. It's easy.
> 
> Henry



More information about the talk mailing list