NYCPHP Meetup

NYPHP.org

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

Jeff Siegel jsiegel1 at optonline.net
Sun Oct 10 10:43:32 EDT 2004


Take a look at this tutorial.

http://www.onlamp.com/pub/a/php/2004/08/26/PHPformhandling.html

Jeff S.

leam at reuel.net wrote:

> 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
> 
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
> 



More information about the talk mailing list