I always have trouble with arrays, and apparently tonight is no exception. I have a form (form.php) that gets sent to another page(email_my_form.php) and the contents are saved into variables with $_POST, with instructions to email a message with the content to me. But it doesn't want to seem to play ball.
I have the same issue with two things - the radio buttons and checkboxes from the form. Everything else is emailing perfectly, but these two are just emailing through as "Quote needed for: Array" and "Services Required: Array". I know it has something to do with me not sending the info to the variable right, or global scope, or something, as it's happened before, but I can't think for the life of me what I did to correct it last time. Hopefully it's just something simple!
I've tried some of the foreach() approaches and print r that were suggested online, but I'm either using them wrong or putting them in the wrong place, as whenever they are on the page, I get a blank screen where my email is not sent correctly. At least with the code I have right now, something is being emailed. It's not the right thing, but something is working, I just need to figure out the next step and would be grateful if someone could help out/point me in the right direction.
form.php
I need a quote for:<br/>
<input type="radio" name="gaq_quote[]" value="Supplies and Installation" checked />Supplies and Installation<br/>
<input type="radio" name="gaq_quote[]" value="Just Supplies" />Just Supplies<br/>
<input type="radio" name="gaq_quote[]" value="Just Installation" />Just Installation<br/><br/>
Job Services Required: <br/>
<input type="checkbox" name="gaq_service[]" value="Roof Insulation"/> Roof Insulation<br/>
<input type="checkbox" name="gaq_service[]" value="Single Wall Insulation"/> Single Wall Insulation<br/>
<input type="checkbox" name="gaq_service[]" value="Multiple Wall Insulation"/> Multiple Wall Insulation
Then, the variables in my email_my_form.php
$gaq_quote = $_POST['gaq_quote'];
$gaq_service = $_POST['gaq_service'];
Relevant part of the message to be emailed:
$message .= 'Quote needed for: ' . $gaq_quote . "\n";
$message .= 'Services Required: ' . $gaq_service . "\n";