email form and redirect depending on the value of a variable

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
mtjmohr
Posts: 22
Joined: Fri 26. Dec 2003, 18:54
Location: Regensburg
Contact:

email form and redirect depending on the value of a variable

Post by mtjmohr »

Hi, everybody,

I have created an email form which suits my needs perfectly well. No problem about that.
But within this form there is a "pulldown menu" which contains 7 items.
Now, item 1, 2, and 7 shall have no consequence, item 3 to 6 shall lead to a credit card payment form.
Is there any option to base the redirection to this credit card payment form only upon the items 3 to 6 chosen?

Cheers :)


Markus Mohr
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

Markus, not possible. If you need something like that it's better to write a small PHP script that does the job.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
mtjmohr
Posts: 22
Joined: Fri 26. Dec 2003, 18:54
Location: Regensburg
Contact:

variable forwarding / POSTing

Post by mtjmohr »

Hello,

is there a way to POST the variables defined in and entered within an email form to another, say a PHP script which then takes these variables over?

Best wishes


Markus
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

Markus,

as I said - it's simple to do this by enhancing the formmailer (act_formmailer.php) script. All POST vars are processed there - you can implement a check there.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
mtjmohr
Posts: 22
Joined: Fri 26. Dec 2003, 18:54
Location: Regensburg
Contact:

Post by mtjmohr »

Thank you, now I got the idea.

Best wishes


Markus
mtjmohr
Posts: 22
Joined: Fri 26. Dec 2003, 18:54
Location: Regensburg
Contact:

Post by mtjmohr »

Hello, Oliver,

here is my primary solution for a self-constructed way to differentiate between 7 forms of membership categories (mc); each mc is being redirected to another absolute URL:

Code: Select all

if(isset($_POST["credit_card1"])) {
  	$credit_card1 = trim($_POST["credit_card1"]);
	unset($_POST["credit_card1"]);
	}
  if(isset($_POST["credit_card2"])) {
  	$credit_card2 = trim($_POST["credit_card2"]);
	unset($_POST["credit_card2"]);
	}
  if(isset($_POST["credit_card3"])) {
  	$credit_card3 = trim($_POST["credit_card3"]);
	unset($_POST["credit_card3"]);
	}
  if(isset($_POST["credit_card4"])) {
  	$credit_card4 = trim($_POST["credit_card4"]);
	unset($_POST["credit_card4"]);
	}

	if (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "National")) {
  	exit();
  }
	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Affiliate")) {
  	exit();
  }
 	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Associated")) {
  	header('Location: '.$credit_card1);
	}
 	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Institutional")) {
  	header('Location: '.$credit_card2);
	}
 	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Corporate")) {
  	header('Location: '.$credit_card3);
	}
 	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Individual")) {
  	header('Location: '.$credit_card4);
	}
	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Student")) {
  	exit();
  }
The only problem I have now is that I do not quite know how to "post" the certain variables I want to send to the credit card form.

Any idea for me?


Best wishes



Markus
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

Code: Select all

header('Location: '.$credit_card1.'?var='.$the_var_I_need.'&secondvar='.$mysecondvar); 
Vars used as GET vars then.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
mtjmohr
Posts: 22
Joined: Fri 26. Dec 2003, 18:54
Location: Regensburg
Contact:

Post by mtjmohr »

Okay, now I got it that way:

Code: Select all

  // Spezielle Erweiterung, um Formular-Daten in einer bestimmten Form an das
  // element5-Credit-Card-Formular übergeben zu können
  //
  // Festlegen der Credit-Card-URLs
  if(isset($_POST["credit_card1"])) {
  	$credit_card1 = trim($_POST["credit_card1"]);
	unset($_POST["credit_card1"]);
	}
  if(isset($_POST["credit_card2"])) {
  	$credit_card2 = trim($_POST["credit_card2"]);
	unset($_POST["credit_card2"]);
	}
  if(isset($_POST["credit_card3"])) {
  	$credit_card3 = trim($_POST["credit_card3"]);
	unset($_POST["credit_card3"]);
	}
  if(isset($_POST["credit_card4"])) {
  	$credit_card4 = trim($_POST["credit_card4"]);
	unset($_POST["credit_card4"]);
	}
  //
  // festlegen der variablen mittels GET, um diese dann im URL übergeben zu
  // können
  //
	if(isset($_GET["Company_Organization"])) {
  	$var1 = trim($_GET["Company_Organization"]);
	unset($_GET["Company_Organization"]);
	}
	if(isset($_GET["Salutation"])) {
  	$var2 = trim($_GET["Salutation"]);
	unset($_GET["Salutation"]);
	}
	if(isset($_GET["First_Name"])) {
  	$var3 = trim($_GET["First_Name"]);
	unset($_GET["First_Name"]);
	}
	if(isset($_GET["Last_Name"])) {
  	$var4 = trim($_GET["Last_Name"]);
	unset($_GET["Last_Name"]);
	}
	if(isset($_GET["Address_1"])) {
  	$var5 = trim($_GET["Address_1"]);
	unset($_GET["Address_1"]);
	}
	if(isset($_GET["Address_2"])) {
  	$var6 = trim($_GET["Address_2"]);
	unset($_GET["Address_2"]);
	}
	if(isset($_GET["ZipCode"])) {
  	$var7 = trim($_GET["ZipCode"]);
	unset($_GET["ZipCode"]);
	}
	if(isset($_GET["City"])) {
  	$var8 = trim($_GET["City"]);
	unset($_GET["City"]);
	}
	if(isset($_GET["State"])) {
  	$var9 = trim($_GET["State"]);
	unset($_GET["State"]);
	}
	if(isset($_GET["Country"])) {
  	$var10 = trim($_GET["Country"]);
	unset($_GET["Country"]);
	}
  //
  // Auswertung nach Membership Categories und anschliessender redirect
  //
	if (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "National")) {
  	exit();
  }
	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Affiliate")) {
  	exit();
  }
 	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Associated")) {
  	header('Location: '.$credit_card1.'?COMPANY='.$var1.'&SALUTATION='.$var2.'&FIRSTNAME='.$var3.'&LASTNAME='.$var4.'&D_STREET1='.$var5.'&D_STREET2='.$var6.'&D_POSTALCODE='.$var7.'&D_CITY='.$var8.'&D_STATE_ID='.$var9.'&D_COUNTRY_ID='.$var10);
	}
 	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Institutional")) {
  	header('Location: '.$credit_card2.'?COMPANY='.$var1.'&SALUTATION='.$var2.'&FIRSTNAME='.$var3.'&LASTNAME='.$var4.'&D_STREET1='.$var5.'&D_STREET2='.$var6.'&D_POSTALCODE='.$var7.'&D_CITY='.$var8.'&D_STATE_ID='.$var9.'&D_COUNTRY_ID='.$var10);
	}
 	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Corporate")) {
  	header('Location: '.$credit_card3.'?COMPANY='.$var1.'&SALUTATION='.$var2.'&FIRSTNAME='.$var3.'&LASTNAME='.$var4.'&D_STREET1='.$var5.'&D_STREET2='.$var6.'&D_POSTALCODE='.$var7.'&D_CITY='.$var8.'&D_STATE_ID='.$var9.'&D_COUNTRY_ID='.$var10);
	}
 	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Individual")) {
  	header('Location: '.$credit_card4.'?COMPANY='.$var1.'&SALUTATION='.$var2.'&FIRSTNAME='.$var3.'&LASTNAME='.$var4.'&D_STREET1='.$var5.'&D_STREET2='.$var6.'&D_POSTALCODE='.$var7.'&D_CITY='.$var8.'&D_STATE_ID='.$var9.'&D_COUNTRY_ID='.$var10);
	}
	elseif (($_POST['label'] == "Membership_Category") && ($_POST['value'] == "Student")) {
  	exit();
  }
Should be working like that or is there an error to be seen?

Many greetings


Markus
mtjmohr
Posts: 22
Joined: Fri 26. Dec 2003, 18:54
Location: Regensburg
Contact:

Post by mtjmohr »

This way it doesn't work. I presume that I have to get the "if .. then" clauses trying to retrieve the membership category information in a different manner.

Any idea?


Markus
mtjmohr
Posts: 22
Joined: Fri 26. Dec 2003, 18:54
Location: Regensburg
Contact:

Post by mtjmohr »

Now I have changed the latter part of the code to:

Code: Select all

  //
  // Auswertung nach Membership Categories und anschliessender redirect
  //
  // if(isset($credit_card_1) || isset($credit_card_2) || isset($credit_card_3) || isset($credit_card_4)) {
	if (($_GET["Membership_Category"] == "National")) {
  	exit();
  }
	elseif (($_GET["Membership_Category"] == "Affiliate")) {
  	exit();
  }
 	elseif (($_GET["Membership_Category"] == "Associated")) {
  	header('Location: '.$credit_card_1.'?COMPANY='.$var1.'&SALUTATION='.$var2.'&FIRSTNAME='.$var3.'&LASTNAME='.$var4.'&D_STREET1='.$var5.'&D_STREET2='.$var6.'&D_POSTALCODE='.$var7.'&D_CITY='.$var8.'&D_STATE_ID='.$var9.'&D_COUNTRY_ID='.$var10);
	}
 	elseif (($_GET["Membership_Category"] == "Institutional")) {
  	header('Location: '.$credit_card_2.'?COMPANY='.$var1.'&SALUTATION='.$var2.'&FIRSTNAME='.$var3.'&LASTNAME='.$var4.'&D_STREET1='.$var5.'&D_STREET2='.$var6.'&D_POSTALCODE='.$var7.'&D_CITY='.$var8.'&D_STATE_ID='.$var9.'&D_COUNTRY_ID='.$var10);
	}
 	elseif (($_GET["Membership_Category"] == "Corporate")) {
  	header('Location: '.$credit_card_3.'?COMPANY='.$var1.'&SALUTATION='.$var2.'&FIRSTNAME='.$var3.'&LASTNAME='.$var4.'&D_STREET1='.$var5.'&D_STREET2='.$var6.'&D_POSTALCODE='.$var7.'&D_CITY='.$var8.'&D_STATE_ID='.$var9.'&D_COUNTRY_ID='.$var10);
	}
 	elseif (($_GET["Membership_Category"] == "Individual")) {
  	header('Location: '.$credit_card_4.'?COMPANY='.$var1.'&SALUTATION='.$var2.'&FIRSTNAME='.$var3.'&LASTNAME='.$var4.'&D_STREET1='.$var5.'&D_STREET2='.$var6.'&D_POSTALCODE='.$var7.'&D_CITY='.$var8.'&D_STATE_ID='.$var9.'&D_COUNTRY_ID='.$var10);
	}
	elseif (($_GET["Membership_Category"] == "Student")) {
  	exit();
  }
  // }
But that did not help either, since the redirection is not being carried out.

BTW, here is the email form "IH|...":

Code: Select all

SM|Membership_Category|1|Your Membership Category: |60,100|National#Affiliate#Associated#Institutional#Corporate#Individual#Student|300
SM|Salutation|0|Salutation|10,15|Mr.#Ms.#Mrs.|75
IT|First_Name|1|First Name: |60,100||300
IT|Last_Name|1|Last Name: |60,100||300
IT|Title|0|Title: |60,100||300
IR|****|0|****: |10,0|Female%1%Female#Male%1%Male|0
IT|Position_Function|0|Position / Function: |60,100||300
IT|Company_Organization|0|Company / Organization: |60,100||300
IT|Department|0|Department: |60,100||300
IT|Address_1|0|Address (Part 1): |60,100||300
IT|Address_2|0|Address (Part 2): |60,100||300
IT|City|0|City: |60,100||300
IT|ZipCode|0|Postal Code / ZIP: |12,15||300
IT|State|0|State (if applicable): |60,100||300
SC|Country|0|Country: |60,100||300
IT|Phone_Office|0|Phone (Office): |20,30||300
IT|Fax|0|Fax: |20,30||300
IT|Phone_Private|0|Phone (Private): |20,30||300
IT|Mobile_Phone|0|Mobile Phone: |20,30||300
IT|email|0|email: |60,100||300
IT|Website|0|Website: |60,100|http://|300
TA|Telemedical_Activities|0|Telemedical Activities: |20,6||300
TA|Special_Interests|0|Special Interests: |20,6||300
TA|Help_Through_ISfT|0|Help Through ISfT: |20,6||300
IH|language|0||10,100|EN|0
IH|credit_card_1|0||10,100|https://secure.element5.com/esales/checkout.html?PRODUCT[xxxxxx]=1&DELIVERY[xxxxxx]=EML&languageid=1&stylefrom=xxxxxx&nolselection=1&noquickbuy=1&currencies=USD|0
IH|credit_card_2|0||10,100|https://secure.element5.com/esales/checkout.html?PRODUCT[xxxxxx]=1&DELIVERY[xxxxxx]=EML&languageid=1&stylefrom=xxxxxx&nolselection=1&noquickbuy=1&currencies=USD|0
IH|credit_card_3|0||10,100|https://secure.element5.com/esales/checkout.html?PRODUCT[xxxxxx]=1&DELIVERY[xxxxxx]=EML&languageid=1&stylefrom=xxxxxx&nolselection=1&noquickbuy=1&currencies=USD|0
IH|credit_card_4|0||10,100|https://secure.element5.com/esales/checkout.html?PRODUCT[xxxxxx]=1&DELIVERY[xxxxxx]=EML&languageid=1&stylefrom=xxxxxx&nolselection=1&noquickbuy=1&currencies=USD|0
IH|redirect_error|0||10,100|http://www.isft.net/cms/index.php?membership_online|0
IH|send_copy|0||10,100|1|0
IH|email|0||10,100|treasurer@isft.net|0
Al lot of code samples, but I want to make things clearer than I might be able to verbalize.

Sincerely


Markus
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

Markus, GET values have to be processed by another script - not the formmailer itself.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
mtjmohr
Posts: 22
Joined: Fri 26. Dec 2003, 18:54
Location: Regensburg
Contact:

Post by mtjmohr »

Maybe I am stupid and / or too unexperienced, but how shall I do this? I only get the values for these variables within the email form. Do I need to "outsource" these values to another script or really get them from another one, and if the latter is true, where is the position for this script?

I thought that I might be able to transfer the values I get out of the email form, i. e. the same values which are also handed over to the email sending process, through an URL redirect to another site or script, in this case the element5 "checkout.html" form which needs to be fed with these variables.

I do not understand, hence, how to handle the GET values. Can you give me some small example, please?

Best wishes


Markus
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

GET values are send via URI like http://mywww?myvalue=5 - that is what you have to add to header(Location:...) as I have decribed above.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
mtjmohr
Posts: 22
Joined: Fri 26. Dec 2003, 18:54
Location: Regensburg
Contact:

Post by mtjmohr »

Yes, but the latest code example does exemplify this, doesn't it?

Code: Select all

if (($_GET["Membership_Category"] == "National")) { 
     exit(); 
  } 
   elseif (($_GET["Membership_Category"] == "Affiliate")) { 
     exit(); 
  } 
    elseif (($_GET["Membership_Category"] == "Associated")) { 
     header('Location: '.$credit_card_1.'?COMPANY='.$var1.'&SALUTATION='.$var2.'&FIRSTNAME='.$var3.'&LASTNAME='.$var4.'&D_STREET1='.$var5.'&D_STREET2='.$var6.'&D_POSTALCODE='.$var7.'&D_CITY='.$var8.'&D_STATE_ID='.$var9.'&D_COUNTRY_ID='.$var10); 
   } 
Best wishes


Markus
User avatar
Oliver Georgi
Site Admin
Posts: 9892
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

But it was done in same file.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Post Reply