Jump to content

Help with a form: I'm stuck!


MainStWebGuy

Recommended Posts

Hello all,

 

I'm new to using php and have started focusing on using it for contact forms. THe following is a form i'd like to use, but i'm having trouble with a couple of things.

 

1. After a user selects which form they would like to fill out, the relevant input fields are displayed, which is great, but if the user selects the wrong form from the drop down box, there is no way for them to "reset" the form and start over... What would be a good way to reset this form in case the user needs to start over? A friend of mine (who knows much more than i) suggested getting rid of the javascript onChange and place a submit and reset button next to the select statement, but i'm not sure how i'd code that in terms of if that reset has been clicked, reset the form, else display the form.

 

2. The other issue actually sending an email that contains the form information. If I'm posting the form using the $_SERVER['PHP_SELF'], where do i call the mail() function?

 

Here's the code....

<?php 
//if the submit button is pressed
if ($_POST['submit'] == true) {
	//set variables from form data
	$name = htmlspecialchars($_POST['cName']);
	$phone = htmlspecialchars($_POST['cPhone']);
	$fax = htmlspecialchars($_POST['faxNumber']);
	$address = htmlspecialchars($_POST['companyAddress']);
	$city = htmlspecialchars($_POST['city']);
	$state = htmlspecialchars($_POST['state']);
	$zip = htmlspecialchars($_POST['zipCode']);
	$fedTaxId = htmlspecialchars($_POST['fedTaxId']);
	$oName = htmlspecialchars($_POST['ownersName']);
	$eCommerceManager = htmlspecialchars($_POST['eCommerceManager']);
	$email = htmlspecialchars($_POST['emailAddress']);
	$whatForm = htmlspecialchars($_POST['serviceForm']);

		/*switch statement
			will go here
			to send the email to 
			the appropriate administrator */


		//tell user that form has been submitted
		//and to check for confirmation
		echo "Your form has been submitted. Check your inbox for a confirmation message.";
	}	else {	//if submit has not been pressed, display form

?>	

<form name="form2" method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<table border="0" cellspacing="0" cellpadding="2">
	<tr>
		<td>Company Name:</td>
		<td>
			<?php
			//if name has been filled in previously,
			//fill in this field
				if ($_POST['cName'] == true) {
					echo'<input type="text" name="cName" value="'.$_POST['cName'].'" />';
				} else {
					echo'<input type="text" name="cName" />';
				}	 
			?>	
		</td>
	</tr>
	<tr>
		<td>Phone Number:</td>
		<td>
			<?php
				if ($_POST['cPhone'] == true) {
					echo'<input type="text" name="cPhone" value="'.$_POST['cPhone'].'" />';
				} else {
					echo'<input type="text" name="cPhone" />';
				}	 
			?>	
		</td>
	</tr>		
	<tr>
		<td>Fax Number:</td>
		<td>
			<?php
				if ($_POST['faxNumber'] == true) {
					echo'<input type="text" name="faxNumber" value="'.$_POST['faxNumber'].'" />';
				} else {
					echo'<input type="text" name="faxNumber" />';
				}	 
			?>				
		</td>
	</tr>
	<tr>
		<td>Company Address:</td>
		<td>
			<?php
				if ($_POST['companyAddress'] == true) {
					echo'<input type="text" name="companyAddress" value="'.$_POST['companyAddress'].'" />';
				} else {
					echo'<input type="text" name="companyAddress" />';
				}	 
			?>				
		</td>
	</tr>
	<tr>
		<td>City:</td>
		<td>
			<?php
				if ($_POST['city'] == true) {
					echo'<input type="text" name="city" value="'.$_POST['city'].'" />';
				} else {
					echo'<input type="text" name="city" />';
				}	 
			?>				
		</td>
	</tr>	
	<tr>
		<td>State:</td>
		<td>
			<?php
				if ($_POST['state'] == true) {
					echo'<input type="text" name="state" value="'.$_POST['state'].'" />';
				} else {
					echo'<input type="text" name="state" />';
				}	 
			?>				
		</td>			
	</tr>
	<tr>
		<td>Zip Code:</td>
		<td>
			<?php
				if ($_POST['zipCode'] == true) {
					echo'<input type="text" name="zipCode" value="'.$_POST['zipCode'].'" />';
				} else {
					echo'<input type="text" name="zipCode" />';
				}	 
			?>				
		</td>			
	</tr>
	<tr>
		<td>Fed Tax ID:</td>
		<td>
			<?php
				if ($_POST['fedTaxId'] == true) {
					echo'<input type="text" name="fedTaxId" value="'.$_POST['fedTaxId'].'" />';
				} else {
					echo'<input type="text" name="fedTaxId" />';
				}	 
			?>				
		</td>			
	</tr>
	<tr>
		<td>Owner's Name:</td>
		<td>
			<?php
				if ($_POST['ownersName'] == true) {
					echo'<input type="text" name="ownersName" value="'.$_POST['ownersName'].'" />';
				} else {
					echo'<input type="text" name="ownersName" />';
				}	 
			?>				
		</td>			
	</tr>
	<tr>
		<td>E-Commerce Manager (if different from above):</td>
		<td>
			<?php
				if ($_POST['eCommerceManager'] == true) {
					echo'<input type="text" name="eCommerceManager" value="'.$_POST['eCommerceManager'].'" />';
				} else {
					echo'<input type="text" name="eCommerceManager" />';
				}	 
			?>				
		</td>			
	</tr>
	<tr>
		<td>Email Address:</td>
		<td>
			<?php
				if ($_POST['emailAddress'] == true) {
					echo'<input type="text" name="emailAddress" value="'.$_POST['emailAddress'].'" />';
				} else {
					echo'<input type="text" name="emailAddress" />';
				}	 
			?>				
		</td>			
	</tr>																		
	<tr>
		<td>What service form do you need to submit?</td>
		<td><select name="serviceForm" onchange="document.forms['form2'].submit();">
				<option>Select One</option>
				<option>EDI</option>
				<option>Glaxis</option>
				<option>EDI and Glaxis</option>
			</select>	
		</td>
	</tr>

<?php 
//depending on what the user chose from the previous drop-down,
//display appropriate fields
switch ($_POST['serviceForm']) {

//if user selected EDI, show these fields
case 'EDI':
	?>
	<tr>
		<td colspan="2"> </td>
	</tr>
	<tr>
		<td colspan="2"><strong>EDI Service Request</strong></td>
	</tr>		
	<tr>
		<td>EDI Volume Plan:</td>
		<td><input name="volumePlan" type="checkbox" value="low volume" /> Low Volume (10 or less invoices/month)<br />
			<input name="volumePlan" type="checkbox" value="standard volume" /> Standard Volume (10+ invoices/month)
		</td>
	</tr>
	<tr>
		<td>Do you accept the EDI Terms of Service?</td>
		<td><select name="ediTermsOfService">
				<option>Yes</option>
				<option>No</option>
			</select>
		</td>
	</tr>		
	<tr>
		<td>How would you like to pay your monthly fees?</td>
		<td><select name="paymentOptions">
				<option>Check (adds $10/month processing fee)</option>
				<option>Direct Debit (E.F.T.)</option>
			</select>	
		</td>
	</tr>
	<tr>
		<td> </td>
	  <td valign="top"><input type="submit" name="submit" value="Send Form" /></td>
	</tr>	 
</table>
</form>		
<?php
//end fields for "EDI" choice		
	break;
//if user selected Glaxis, show these fields		
case 'Glaxis':
	?>
	<tr>
		<td colspan="2"> </td>
	</tr>		
	<tr>
		<td colspan="2"><strong>Glaxis Service Request</strong></td>
	</tr>		
	<tr>
		<td>Previous Lynx Dispatch Number:</td>
		<td><input type="text" name="lynxDispatch" /></td>
	</tr>
	<tr>
		<td>When would you like to go Live??</td>
		<td><input type="text" name="liveDate" /></td>
	</tr>
	<tr>
		<td>Would you like to setup PPG online ordering?</td>
		<td><select name="ppgOnlineOrdering">
				<option>Yes</option>
				<option>No</option>
			</select>
		</td>
	</tr>
	<tr>
		<td>Do you accept the Glaxis Terms of Service?</td>
		<td><select name="glaxisTermsOfService">
				<option>Yes</option>
				<option>No</option>
			</select>	
		</td>
	</tr>		
	<tr>
		<td> </td>
	  <td valign="top"><input type="submit" name="submit" value="Send Form" /></td>
	</tr>	 
</table>
</form>		
<?php
//end fields for "Glaxis" choice	
	break;
//if user selected EDI and Glaxis, show these fields		
case 'EDI and Glaxis':
	?>
	<tr>
		<td colspan="2"> </td>
	</tr>		
	<tr>
		<td colspan="2"><strong>EDI Service Request</strong></td>
	</tr>	
	<tr>
		<td>EDI Volume Plan:</td>
		<td><input name="volumePlan" type="checkbox" value="low volume" /> Low Volume (10 or less invoices/month)<br />
			<input name="volumePlan" type="checkbox" value="standard volume" /> Standard Volume (10+ invoices/month)
		</td>
	</tr>
	<tr>
		<td>How would you like to pay your monthly fees?</td>
		<td><select name="paymentOptions">
				<option>Check (adds $10/month processing fee)</option>
				<option>Direct Debit (E.F.T.)</option>
			</select>	
		</td>
	</tr>
	<tr>
		<td>Do you accept the EDI Terms of Service?</td>
		<td><select name="termsOfService">
				<option>Yes</option>
				<option>No</option>
			</select>
		</td>
	</tr>
	<tr>
	<tr>
		<td colspan="2"> </td>
	</tr>		
		<td colspan="2"><strong>Glaxis Service Request</strong></td>
	</tr>		
	<tr>
		<td>Previous Lynx Dispatch Number:</td>
		<td><input type="text" name="lynxDispatch" /></td>
	</tr>
	<tr>
		<td>When would you like to go Live??</td>
		<td><input type="text" name="liveDate" /></td>
	</tr>
	<tr>
		<td>Would you like to setup PPG online ordering?</td>
		<td><select name="ppgOnlineOrdering">
				<option>Yes</option>
				<option>No</option>
			</select>
		</td>
	</tr>
	<tr>
		<td>Do you accept the Glaxis Terms of Service?</td>
		<td><select name="glaxisTermsOfService">
				<option>Yes</option>
				<option>No</option>
			</select>	
		</td>
	</tr>			
	<tr>
		<td> </td>
	  <td valign="top"><input type="submit" name="submit" value="Send Form" /></td>
	</tr>	 
</table>
</form>		
<?php
//end fields for EDI and Glaxis	
	break;
}					

}
?>

 

I've posted this question on a couple other forms, but no one has had any ideas yet. Am i complicating things with this form? Keep in mind that' i'm a complete newbie so if someone has another idea that will do the job, please share!!

 

thanks in advance guys and gals!

 

Link to comment
Share on other sites

1. After a user selects which form they would like to fill out, the relevant input fields are displayed, which is great, but if the user selects the wrong form from the drop down box, there is no way for them to "reset" the form and start over... What would be a good way to reset this form in case the user needs to start over? A friend of mine (who knows much more than i) suggested getting rid of the javascript onChange and place a submit and reset button next to the select statement, but i'm not sure how i'd code that in terms of if that reset has been clicked, reset the form, else display the form.

 

2. The other issue actually sending an email that contains the form information. If I'm posting the form using the $_SERVER['PHP_SELF'], where do i call the mail() function?

1.  Two ways:

  a. Put a "Reset" button by the select (that's not actually a reset input element) and have the onClick() event for that hide all of the forms (effectively resetting to before an option was chosen).

  b. Do as the other guy said (with a submit and reset button) and make the submit pass the select value in its own form, then display the proper form based upon that value.  Make the reset button just a plain button (as in the above option) and display no forms if !empty($_POST['resetbuttonname']).  Alternatively, just put a "None" option in the select and, when that gets submitted, display no forms.

 

2.  Anywhere, really.  Traditionally, though, I've always seen form processing code at the top of the page, encased in a isset($_POST['whatever']) conditional.  That way, you only execute the mail() code when the form is actually submitted.

Link to comment
Share on other sites

<?php 
//if the submit button is pressed
if ($_POST['submit'] == true) {
	//set variables from form data
	$name = htmlspecialchars($_POST['cName']);
	$phone = htmlspecialchars($_POST['cPhone']);
	$fax = htmlspecialchars($_POST['faxNumber']);
	$address = htmlspecialchars($_POST['companyAddress']);
	$city = htmlspecialchars($_POST['city']);
	$state = htmlspecialchars($_POST['state']);
	$zip = htmlspecialchars($_POST['zipCode']);
	$fedTaxId = htmlspecialchars($_POST['fedTaxId']);
	$oName = htmlspecialchars($_POST['ownersName']);
	$eCommerceManager = htmlspecialchars($_POST['eCommerceManager']);
	$email = htmlspecialchars($_POST['emailAddress']);
	$whatForm = htmlspecialchars($_POST['serviceForm']);

		/*switch statement
			will go here
			to send the email to 
			the appropriate administrator */


		//tell user that form has been submitted
		//and to check for confirmation
		echo "Your form has been submitted. Check your inbox for a confirmation message.";
	}	else {	//if submit has not been pressed, display form

?>	

<html>
<head></head>
<body>
<form name="form2" method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<table border="0" cellspacing="0" cellpadding="2">
	<tr>
		<td>Company Name:</td>
		<td>
			<?php
			//if name has been filled in previously,
			//fill in this field
				if ($_POST['cName'] == true) {
					echo'<input type="text" name="cName" value="'.$_POST['cName'].'" />';
				} else {
					echo'<input type="text" name="cName" />';
				}	 
			?>	
		</td>
	</tr>
	<tr>
		<td>Phone Number:</td>
		<td>
			<?php
				if ($_POST['cPhone'] == true) {
					echo'<input type="text" name="cPhone" value="'.$_POST['cPhone'].'" />';
				} else {
					echo'<input type="text" name="cPhone" />';
				}	 
			?>	
		</td>
	</tr>		
	<tr>
		<td>Fax Number:</td>
		<td>
			<?php
				if ($_POST['faxNumber'] == true) {
					echo'<input type="text" name="faxNumber" value="'.$_POST['faxNumber'].'" />';
				} else {
					echo'<input type="text" name="faxNumber" />';
				}	 
			?>				
		</td>
	</tr>
	<tr>
		<td>Company Address:</td>
		<td>
			<?php
				if ($_POST['companyAddress'] == true) {
					echo'<input type="text" name="companyAddress" value="'.$_POST['companyAddress'].'" />';
				} else {
					echo'<input type="text" name="companyAddress" />';
				}	 
			?>				
		</td>
	</tr>
	<tr>
		<td>City:</td>
		<td>
			<?php
				if ($_POST['city'] == true) {
					echo'<input type="text" name="city" value="'.$_POST['city'].'" />';
				} else {
					echo'<input type="text" name="city" />';
				}	 
			?>				
		</td>
	</tr>	
	<tr>
		<td>State:</td>
		<td>
			<?php
				if ($_POST['state'] == true) {
					echo'<input type="text" name="state" value="'.$_POST['state'].'" />';
				} else {
					echo'<input type="text" name="state" />';
				}	 
			?>				
		</td>			
	</tr>
	<tr>
		<td>Zip Code:</td>
		<td>
			<?php
				if ($_POST['zipCode'] == true) {
					echo'<input type="text" name="zipCode" value="'.$_POST['zipCode'].'" />';
				} else {
					echo'<input type="text" name="zipCode" />';
				}	 
			?>				
		</td>			
	</tr>
	<tr>
		<td>Fed Tax ID:</td>
		<td>
			<?php
				if ($_POST['fedTaxId'] == true) {
					echo'<input type="text" name="fedTaxId" value="'.$_POST['fedTaxId'].'" />';
				} else {
					echo'<input type="text" name="fedTaxId" />';
				}	 
			?>				
		</td>			
	</tr>
	<tr>
		<td>Owner's Name:</td>
		<td>
			<?php
				if ($_POST['ownersName'] == true) {
					echo'<input type="text" name="ownersName" value="'.$_POST['ownersName'].'" />';
				} else {
					echo'<input type="text" name="ownersName" />';
				}	 
			?>				
		</td>			
	</tr>
	<tr>
		<td>E-Commerce Manager (if different from above):</td>
		<td>
			<?php
				if ($_POST['eCommerceManager'] == true) {
					echo'<input type="text" name="eCommerceManager" value="'.$_POST['eCommerceManager'].'" />';
				} else {
					echo'<input type="text" name="eCommerceManager" />';
				}	 
			?>				
		</td>			
	</tr>
	<tr>
		<td>Email Address:</td>
		<td>
			<?php
				if ($_POST['emailAddress'] == true) {
					echo'<input type="text" name="emailAddress" value="'.$_POST['emailAddress'].'" />';
				} else {
					echo'<input type="text" name="emailAddress" />';
				}	 
			?>				
		</td>			
	</tr>																		
	<tr>
		<td>What service form do you need to submit?</td>
		<td><select name="serviceForm" onchange="document.form2.submit();">
				<option>Select One</option>
				<option>EDI</option>
				<option>Glaxis</option>
				<option>EDI and Glaxis</option>
			</select>	
		</td>
	</tr>

<?php 
//depending on what the user chose from the previous drop-down,
//display appropriate fields

switch ($_POST['serviceForm']) {

//if user selected EDI, show these fields
case 'EDI':
	?>
	<tr>
		<td colspan="2"> </td>
	</tr>
	<tr>
		<td colspan="2"><strong>EDI Service Request</strong></td>
	</tr>		
	<tr>
		<td>EDI Volume Plan:</td>
		<td><input name="volumePlan" type="checkbox" value="low volume" /> Low Volume (10 or less invoices/month)<br />
			<input name="volumePlan" type="checkbox" value="standard volume" /> Standard Volume (10+ invoices/month)
		</td>
	</tr>
	<tr>
		<td>Do you accept the EDI Terms of Service?</td>
		<td><select name="ediTermsOfService">
				<option>Yes</option>
				<option>No</option>
			</select>
		</td>
	</tr>		
	<tr>
		<td>How would you like to pay your monthly fees?</td>
		<td><select name="paymentOptions">
				<option>Check (adds $10/month processing fee)</option>
				<option>Direct Debit (E.F.T.)</option>
			</select>	
		</td>
	</tr>
	<tr>
		<td> </td>
	  <td valign="top"><input type="submit" name="submit2" value="Send Form" /></td>
	</tr>	 
</table>
</form>
</body>
</html>
<?php
//end fields for "EDI" choice		
	break;
//if user selected Glaxis, show these fields		
case 'Glaxis':
	?>
	<tr>
		<td colspan="2"> </td>
	</tr>		
	<tr>
		<td colspan="2"><strong>Glaxis Service Request</strong></td>
	</tr>		
	<tr>
		<td>Previous Lynx Dispatch Number:</td>
		<td><input type="text" name="lynxDispatch" /></td>
	</tr>
	<tr>
		<td>When would you like to go Live??</td>
		<td><input type="text" name="liveDate" /></td>
	</tr>
	<tr>
		<td>Would you like to setup PPG online ordering?</td>
		<td><select name="ppgOnlineOrdering">
				<option>Yes</option>
				<option>No</option>
			</select>
		</td>
	</tr>
	<tr>
		<td>Do you accept the Glaxis Terms of Service?</td>
		<td><select name="glaxisTermsOfService">
				<option>Yes</option>
				<option>No</option>
			</select>	
		</td>
	</tr>		
	<tr>
		<td> </td>
	  <td valign="top"><input type="submit" name="submit2" value="Send Form" /></td>
	</tr>	 
</table>
</form>
</body>
</html>
<?php
//end fields for "Glaxis" choice	
	break;
//if user selected EDI and Glaxis, show these fields		
case 'EDI and Glaxis':
	?>
	<tr>
		<td colspan="2"> </td>
	</tr>		
	<tr>
		<td colspan="2"><strong>EDI Service Request</strong></td>
	</tr>	
	<tr>
		<td>EDI Volume Plan:</td>
		<td><input name="volumePlan" type="checkbox" value="low volume" /> Low Volume (10 or less invoices/month)<br />
			<input name="volumePlan" type="checkbox" value="standard volume" /> Standard Volume (10+ invoices/month)
		</td>
	</tr>
	<tr>
		<td>How would you like to pay your monthly fees?</td>
		<td><select name="paymentOptions">
				<option>Check (adds $10/month processing fee)</option>
				<option>Direct Debit (E.F.T.)</option>
			</select>	
		</td>
	</tr>
	<tr>
		<td>Do you accept the EDI Terms of Service?</td>
		<td><select name="termsOfService">
				<option>Yes</option>
				<option>No</option>
			</select>
		</td>
	</tr>
	<tr>
	<tr>
		<td colspan="2"> </td>
	</tr>		
		<td colspan="2"><strong>Glaxis Service Request</strong></td>
	</tr>		
	<tr>
		<td>Previous Lynx Dispatch Number:</td>
		<td><input type="text" name="lynxDispatch" /></td>
	</tr>
	<tr>
		<td>When would you like to go Live??</td>
		<td><input type="text" name="liveDate" /></td>
	</tr>
	<tr>
		<td>Would you like to setup PPG online ordering?</td>
		<td><select name="ppgOnlineOrdering">
				<option>Yes</option>
				<option>No</option>
			</select>
		</td>
	</tr>
	<tr>
		<td>Do you accept the Glaxis Terms of Service?</td>
		<td><select name="glaxisTermsOfService">
				<option>Yes</option>
				<option>No</option>
			</select>	
		</td>
	</tr>			
	<tr>
		<td> </td>
	  <td valign="top"><input type="submit" name="submit2" value="Send Form" /></td>
	</tr>	 
</table>
</form>
</body>
</html>
<?php
//end fields for EDI and Glaxis	
	break;
default:
	?>

		</table>
</form>
</body>
</html>
<?php
}					

}
?>

 

this should fix #1

 

as for #2  Google php send mail, you'll find many examples

Link to comment
Share on other sites

If I'm posting the form using the $_SERVER['PHP_SELF'], where do i call the mail() function?

 

you could do it like this:

 

in each add on form, create a hidden input:

 

<input type="hidden" name="addon" value="">

 

then on top of your php code check if this exists

 

if (isset($_POST['addon'])) {
    if ($_POST['addon'] == 'go!') {
    // proccess form, send mail, display thank you message

    exit;
   )
}
// otherwise, just show the form

 

ok so so far, we should be able to change the subforms, but not send the form.

to send the form and not break the form selection in this setup, use javascript to change the value of addon to "go!" when submit button is clicked (onclick).

 

hope this helps

Link to comment
Share on other sites

@machupicchu ->

 

This is exacly what i was trying to do!! Thanks a bunch! as i'm a newbie to javascript as well, what's the difference between the javascript you provided and the one i had (other than mine wasn't working haha)

 

What's going on with: onchange="document.form2.submit();"

 

that's not going on with onchange="document.forms['form2'].submit();"

 

just curious... thanks again!

Link to comment
Share on other sites

@sasa

I'll be honest normally that's what i would have done but i'm still learning php and all the things it can do and thought this project would be a good way to learn some more. That's really it. just wanted to jump right in so to speak :-)

 

I figured there was a way to make it happen on one page but my in my newbness i couldn't figure it out

Link to comment
Share on other sites

@machupicchu ->

 

This is exacly what i was trying to do!! Thanks a bunch! as i'm a newbie to javascript as well, what's the difference between the javascript you provided and the one i had (other than mine wasn't working haha)

 

What's going on with: onchange="document.form2.submit();"

 

that's not going on with onchange="document.forms['form2'].submit();"

 

just curious... thanks again!

 

onchange="document.form2.submit();

and

onchange="document.forms['form2'].submit();

 

seem to do the same thing, the problem was this:

 

<input type="submit" name="submit" value="Send Form" />

 

it seemed to have been interfering with the above, so notice I added a 2 to the name,

 

<input type="submit" name="submit2" value="Send Form" />

 

to have this be name something other than submit, and voila, it works.

 

Link to comment
Share on other sites

...to send the form and not break the form selection in this setup, use javascript to change the value of addon to "go!" when submit button is clicked (onclick).

 

hope this helps

 

almost there!!

 

Sorry to be annoying, but i have no idea what code to use or where to put the javascript  to change the value of that hidden form when the submit is clicked... would i put it where the submit button is or on the hidden field? What would be the proper code to change the value to 'go'?

 

thanks again for all your help, i greatly appreciate your patience and willingness to share your know-how!!

Link to comment
Share on other sites

do similar like you have here:

<select name="serviceForm" onchange="document.form2.submit();">

 

this seems to work:

<input type="submit" name="submit2" value="Send Form" onclick="addon.value = 'go!';"/>

 

you can get to the addon value like this also:  document.form2.addon.value, but it seems to be optional.

 

make sure to do this for every submit button that you have, and this being the very first lines of your php:

 

echo $_POST['addon']."!!!!!!";  //test the addon value like this, remove this when everything is working as it should
if (isset($_POST['addon'])) {
    if ($_POST['addon'] == 'go!') {
    // proccess form, send mail, display thank you message

    exit;
    }
}

 

I'm glad I've helped you  ;)

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.