DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   How do I get an input form to reload itself (http://www.daniweb.com/forums/thread18026.html)

Swashbuckler Feb 4th, 2005 7:44 am
How do I get an input form to reload itself
 
Hi guys, hope you can help me. I've created a form in Dreamweaver (using the insert record wizard) which is linked to a MYSQL database. Trouble is once all the information is inputted and submitted I want the page to reload itself again so I have a fresh form to insert data again. For some reason it redirects to a new htm page (and not the PHP page I originally started with) e.g data.htm and not data.php. Any ideas would be appreciated.

pcschrottie Feb 7th, 2005 11:23 am
Re: How do I get an input form to reload itself
 
What does the action attribute of the form - tag say?



Michael

Gary King Feb 11th, 2005 12:13 am
Re: How do I get an input form to reload itself
 
yes, check that; otherwise, just use header() function to redirect to desired page

mcldev Feb 22nd, 2005 9:41 pm
Re: How do I get an input form to reload itself
 
A script can call itself by: $PHP_SELF (v4) or _SERVER['PHP_SELF'] (v5).

To make it happen in HTML, you simply need to add a statement like:

<form action="_SERVER['PHP_SELF']" method="post">

Make sure you use the appropriate conditional so that the script does not get in a loop, i.e. if ($safe_to_proceed) { ... }. Similary if you wish to call your $PHP_SELF script direct from the script itself then we're talking recursion. So be forewarned that recursiuon is great but best used ONLY on simple tight algorithms.


All times are GMT -4. The time now is 6:20 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC