I need help please-- page redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

I need help please-- page redirect

Post 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..
Last edited by prue_ on Thu May 07, 2009 10:47 pm, edited 1 time in total.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: I need help please!

Post by Christopher »

Can you show some code?
(#10850)
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Re: I need help please-- page redirect

Post 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 :)
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

Re: I need help please-- page redirect

Post by prue_ »

code deleted
Last edited by prue_ on Thu Jun 18, 2009 7:02 am, edited 3 times in total.
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

Re: I need help please-- page redirect

Post by prue_ »

are you guys still there? i don't know how to search my answers on google...
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Re: I need help please-- page redirect

Post 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.
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

Re: I need help please-- page redirect

Post 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...
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: I need help please-- page redirect

Post by Benjamin »

@prue_, use code tags when posting code. Please ask if you are unsure how.
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

Re: I need help please-- page redirect

Post by prue_ »

oh im so sorry, i didn't know it was supposed to be like that.. next time i will. thank you though
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Re: I need help please-- page redirect

Post 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).
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

Re: I need help please-- Curl

Post by prue_ »

code deleted
Last edited by prue_ on Thu Jun 18, 2009 7:02 am, edited 1 time in total.
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Re: I need help please-- page redirect

Post by mickd »

In $formfields you're missing a few ,'s at the end of some lines for the array declaration.
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

Re: I need help please-- page redirect

Post by prue_ »

still doesn't work.. any ideas? thanks
Post Reply