Jump to content

POST values of radio button and checkboxes


NickG21

Recommended Posts

hey everyone, i am looking to get the values of my radio buttons and checkboxes and have the values added to my $msg variable and sent in an e-mail.  this is my code:

<?php
if (isset($_POST['submit'])) {
$company = $_POST['CompanyName'];
$name = $_POST['realname'];
$email = $_POST['email'];
$domainName = $_POST['ListOrDomainName'];
$username = $_POST['Username'];
$password = $_POST['Password'];
$credit = $_POST['CreditCardNumber'];
$resend = $_POST['Resend']; <---Checkbox
$subject = 'Cancellation Request';
$reasons = $_POST['Reasons']; <---Checkboxes
$ServiceName = $_POST['ServiceName']; <----Radio Buttons
$to = '';

if (empty($username) && empty($password)){
$to = 'blah@mail.com';
$msg .= $company;
$msg .= $name;
$msg .= $domainName;
$msg .= $resend;
$msg .= $reasons;
$msg .= $ServiceName;
}else{
$to = 'blahblah@mail.com';
$msg .= $company;
$msg .= $name;
$msg .= $domainName;
$msg .= $resend;
$msg .= $reasons;
$msg .= $ServiceName;
}
mail($to, $subject, $msg, "From: $name, <$email>");
header("location: .../thankyou.html");
}

?>

the e-mails send well and change the e-mail address accordingly except the only things i get in the email are the text boxes entered and

the word

 

"array" if any of the other items are checked off.  any ideas?

Link to comment
Share on other sites

if your radio buttons return a bit of text ie the value (<input type = 'radio' name = 'name' value = 'some text)

 

what might be happening is your not setting the value for the radio box on the form and therefore its returning a null or '' empty string.

 

 

can you post the form code

 

Link to comment
Share on other sites

The entire form is pretty lengthy but here are the areas with the checkboxes and radio buttons, i hope it isn't too messy

 

<input type="checkbox" name="Resemd" ID="OwnersManual" value="Yes" onClick="DisableControlGroup(this, request)"> 
						Request to resend the owners manual.
					  <p class="note" style="padding: 0.3em 1em;  font-weight:
normal;">Skip the rest of the fields and <a href="#submit">click the
"Submit" button</a> at the bottom of the page.<br>

						For your protection, we cannot process your cancellation request
until we confirm your customer verification information. </p>
					</div>
				</td>
			</tr>
			<tr>
				<td class="header">Service to Cancel</td>
			</tr>
			<tr>

				<td class="oneColumnOptions">
					<input name="ServiceName" id="request" type="radio" value="Announcement Email
List Hosting"> Announcement Email List Hosting<br>
					<input name="ServiceName" id="request" type="radio" value="Discussion Email
List Hosting"> Discussion Email List Hosting<br>
					<input name="ServiceName" id="request" type="radio" value="Web Hosting"> Web
Site Hosting<br>
					<input name="ServiceName" id="request" type="radio" value="Pay Per Click Bid
Management"> Pay Per Click Bid Management<br>

					<input name="ServiceName" id="request" type="radio" value="Dedicated Server">
Dedicated Server Hosting<br>
					<input name="ServiceName" id="request" type="radio" value="Enterprise Email
Filtering"> Enterprise Email Filtering<br>
					<input name="ServiceName" id="request" type="radio" value="Email / Webmail
Accounts"> Email / Webmail Accounts<br>
					<input name="ServiceName" id="request" type="radio" value="Other"> Other
<input name="ServiceName" id="request" size="30">	
			  </td>

			</tr>
			<tr>
				<td class="header">Reasons for Canceling <span class="note"
style="padding-left: 1em; font-size: 80%;">(Check all that apply.)</span> 
</td>
			</tr>
			<tr>
			  	<td class="oneColumnOptions">
			  		<input type="checkbox" name="Reasons" id="request" value="NotUsing Service"> Not Using Service<br>

			  		<input type="checkbox" name="Reasons" id="request"
value="Dissatisfied with Features of Service" id="request"> Dissatisfied with Features 
of Service<br>
					<input type="checkbox" name="Reasons"
value="Ineffective Business Solution" id="request"> Ineffective Business Solution<br>
<!-- specifically for mailing list -->				
					<input type="checkbox" name="Reasons" id="request" value="Only Send Occational Mailings">					    
					Only Send Occasional Mailings (<span class="note"
style="font-weight: normal;">For Mailing List Hosting only</span>)<br>
                        <input type="checkbox" name="Reasons" id="request" value="Poor Delivery of Email Newsletter to Subscribers">
Poor Delivery of Email Newsletter to Subscribers (<span class="note"
style="font-weight: normal;">For Mailing List Hosting only</span>)<br>

<!-- -->		
					<input type="checkbox" name="Reasons" id="request" value="Found a 
Less Expensive Alternative"> Found a Less Expensive Alternative<br>
					<input type="checkbox" name="Reasons" id="request" value="Went
with an In-house Solution"> Went with an In-house Solution<br>
					<input type="checkbox" name="Reasons" id="request"
value="Technical Issues"> Technical Issues<br>
					<input type="checkbox" name="Reasons" id="request" value="Too
Difficult to Use Service"> Too Difficult to Use Service<br>

					<input type="checkbox" name="Reasons" id="request" 
value="Dissatisfied with Technical Support"> Dissatisfied with Technical
Support<br>

					<input type="checkbox" name="Reasons" id="request" value="Poor
Customer Service"> Poor Customer Service<br>
					<input type="checkbox" name="Reasons" id="request" value="Poor
Billing Process"> Poor Billing Process<br>
					<input type="checkbox" name="Reasons" id="request" value="Went
Out of Business"> Went Out of Business<br>
					<input type="checkbox" name="Reasons" id="request" value="Sold
Company"> Sold Company<br>
					<input type="checkbox" name="Reasons" id="request" value="Other"> 
Other <input name="OtherReasons" id="request" size="30">

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.