Form action leads to different Page

Sorry kinda hard to find a title for this...

Anyway:

I have a simple html page (page1) with a form on it. Now when the form is submitted i want to call a php page (page2) that handles the data. So far so good. The Problem is, that when the form is submitted the browser loads page2 but i want the user to stay on page1 even after submitting the info... Any thoughts on how i can do that ?

#304241

Submit the page to itsself (page1 submits to page1) and do the processing at the top before any content loads.

#304264

Hi !

I can´t process the data in page1 bc page one is automatically generated by an php script. So i have/want to keep the processing code in a different file.

#304268

try put this below the process

header("Refresh: 0;url=http://www.yourdomain.com/page1");

before this code

?><?php

}

?>

#304284

try put this below the process

header("Refresh: 0;url=http://www.yourdomain.com/page1");

before this code

?><?php

}

?>

Another option is:

header("Location: http://www.yourdomain.com/page1");

although both do pretty much the same thing.

Don't forget that you can't send headers after any output (including whitespace) has been sent to the browser.

#304290

i wish i can code php. you guys kickass!

#304392

its just a simple php to process form. If you want the code, I can give it to you.

#304395

i wish i can code php.

You really don't wish that :P What you actually wish is ASP.NET ;)

#304397

all those self-processing codes are a pain in the ass. i always get my site's code in one of 'em free cgi scripts sites. i want to have a guestbook in my site that uses smileys. my guestbook only uses the .pl (or is it .cgi) file.

#304402

With self coding, you have total control on the layout and script behavior. I start by downloading free scripts too, using it to learn how they make the coding.

#304424

@ alang & Ludge Thanks a lot - that worked !

#304426

No problem, glad I can help

#304462