Page 1 of 1

I need help please-- page redirect

Posted: Thu May 07, 2009 10:42 pm
by prue_
hello I'm new in programming, i hope someone could help me here. i have 4 links and all of them have to be open on popup page (mail form with name, email and telephone and captcha).. i already have this.. the problem is each link has to be redirected on different pages after the form has been submitted.. how can I do this... thanks a lot.. i hope someone could help asap..

Re: I need help please!

Posted: Thu May 07, 2009 10:47 pm
by Christopher
Can you show some code?

Re: I need help please-- page redirect

Posted: Thu May 07, 2009 10:53 pm
by mickd
The header function can be used to do page redirections in php, but I'm not sure i 100% understand what you needed done, so this might not be what you want.

Code would be great :)

Re: I need help please-- page redirect

Posted: Thu May 07, 2009 10:56 pm
by prue_
code deleted

Re: I need help please-- page redirect

Posted: Thu May 07, 2009 11:02 pm
by prue_
are you guys still there? i don't know how to search my answers on google...

Re: I need help please-- page redirect

Posted: Thu May 07, 2009 11:14 pm
by mickd
Oh, so the form is on multiple different pages (and you would like it to redirect back to the page it came from)?

I guess you could use a html hidden field that stored the current page before you submit the form, store the previous page in a session, or store the information in the url when you post to that page (form.php?returnpage=url), then use the header function i posted earlier to return to that page.

Re: I need help please-- page redirect

Posted: Thu May 07, 2009 11:26 pm
by prue_
all links goes on the same pupop page.. (link1, link2, link3 and link4).. for example.. if the user clicks on link1 (a pupop page will open) then the user will submit the form then the page will redirect to link1.php.. if the user clicks on link2 (a pupop page will open) then the user will submit the form then the page will redirect to link2.php.. and so on.. im already aware of the header function.. just dont know how implement it in this case...

Re: I need help please-- page redirect

Posted: Thu May 07, 2009 11:28 pm
by Benjamin
@prue_, use code tags when posting code. Please ask if you are unsure how.

Re: I need help please-- page redirect

Posted: Thu May 07, 2009 11:33 pm
by prue_
oh im so sorry, i didn't know it was supposed to be like that.. next time i will. thank you though

Re: I need help please-- page redirect

Posted: Fri May 08, 2009 12:04 am
by mickd
Much nicer with the code tags added :)

I'm guessing that could be solved using javascript. When the user clicks on a link, use javascript to append a "referrer" tag at the end of the form action, like
action="scripts/sendmail.php?referrer=link1".

I don't use javascript, so i can't write a function for it (and so what i say from here might not be right), but you would have an onClick or some function on the hyperlink, and the function it calls adds "?referrer=$something" to end of the form action, with $something equal to the value of the link (link1/link2/etc).

Then in the actual form processing script, you'll just retrieve that using $_GET and header redirect it to that page (make sure you limit what it can direct to, for possible security reasons).

Re: I need help please-- Curl

Posted: Mon May 11, 2009 2:50 am
by prue_
code deleted

Re: I need help please-- page redirect

Posted: Mon May 11, 2009 8:34 pm
by mickd
In $formfields you're missing a few ,'s at the end of some lines for the array declaration.

Re: I need help please-- page redirect

Posted: Tue May 12, 2009 10:17 pm
by prue_
still doesn't work.. any ideas? thanks