Jump to content

HELP! PHP Form sending Blank Inputs to email


RMDesign

Recommended Posts

Hello, I am very very new to PHP and have created a form that changes depending on a selection option.

 

The website is here http://www.rmdesignstudio.com.au/wraptinprint/quotes.php and the PHP is all on the quotes.php page.

 

The form sends to the email but when you fill in one form (example: Business Cards) the form sends, but along with all the entered fields the email also includes all the fields in all the hidden forms that werent filled in.

 

I believe it is because they are drop down boxes and it is sending the first option in the list which happens to be "-----Please Select-----"

 

Is there something I should be doing to my selection input field for this not to show up? Otherwise is there something I need to add to my PHP so it checks for the fields being filled in?

 

I dont know how to add my code to this post, so if you could either show me or view my code via view source that would be awesome.

Link to comment
Share on other sites

Thanks for the reply, unfortunately this just made the default option another thing which also automatically shows up in the email

 

What i want is for the user to choose whether they want to input details into these fields or leave them at the ----please select--- option.

 

if left at the ----please select----- option i want that input to be discluded from the email

 

Is there a way I can do this?

Link to comment
Share on other sites

When you're capturing the data that the user submitted, just ignore the input if nothing was selected.  For example:

 

Print Quantity:
<select name="quantity2">
  <option value="">--Please Select--</option>
  <option value="500"></option>
  <option value="1000"></option>
  <option value="2500"></option>
  <option value="Other"></option>
</select>

 

You might notice the value="" on the "--Please Select--" option element.  Then handle the post:

 

<?php
if (isset($_POST['quantity2']) && $_POST['quantity2'] != '')
{
  // Add quantity to the email since it wasn't left blank
}
?>

 

Hope that puts you in the right direction.

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.