PHP Help - form to switch function redirect

1 replies
Overview:
I need some help, I think I have the concept down but the code isn't coming together ( I am still new to web development, my background is VBA).
What I am trying to do is based on what sub domain they signup at, redirect to the right offer / squeeze page.

It would be nice if the subdomain value stayed with the form in a hidden field (I think I can do this) so I can track sign up source but this isn't critical and can be done after I get this part ironed out.

So if I have
sub1 - offer1
sub2 - offer 2
sub 3 - offer 3
so on and so forth

Technical:
Signup form from MailChimp on each subdomain presale page, all forms at Mail chimp will point to toplevel.com/switch.php which will perform the redirect. I think I need to pass from subdomain as a variable to the switch.php function / page, not real sure how to do this?

Here is what I have for the redirect code so far.

Code:
/* 
This would be the .php page I am sending the form to -
from here it would detect which subdomain and then route to the
affiliate offer / squeeze page
*/
switch ($subdomain)
{
case sub1:
  send to affiliate offer number1 if n=sub1;
  break;
case sub2:
  send to affiliate offer number2 if n=sub2;
  break;
case sub3:
  send to affiliate offer number3 if n=sub3;
  break;
...
default:
	// Not sure what the default will be, maybe a squeeze on the TLD
  code to be executed if n is different from all labels;
Here is the MC form if you need it, it is the standard form they give:

Code:
//Mailchimp form
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="Some list" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>

<div class="mc-field-group">
	<label for="mce-EMAIL">Email Address </label>
	<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div class="mc-field-group">
	<label for="mce-FNAME">First Name </label>
	<input type="text" value="" name="FNAME" class="required" id="mce-FNAME">
</div>
	<div id="mce-responses" class="clear">
		<div class="response" id="mce-error-response" style="display:none"></div>
		<div class="response" id="mce-success-response" style="display:none"></div>
	</div>	<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</form>
</div>

<!--End mc_embed_signup-->
Sorry to ask for a bunch of coding but I am beating my head again the wall.
#form #function #php #redirect #switch

Trending Topics