Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP checkbox results

Status
Not open for further replies.
Mar 28, 2006
70
I have a a form with 5 checkboxes and 1 text field. I am trying to email those results. I have everything setup for the email, etc, except the forum results. How can I take those 6 forum field results and combine them into a single variable to place in my mail() function?

Thanks!
 
Concatenation.

$bodyofemail="The results are: " . $checkboxvalue1 . $checkboxvalue2 . $checkboxvalueX . $textboxcontents;







----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Here is my code:

<?
if (!$hidSubmit) {
?>
<form method="post" action="<? print $_SERVER['SCRIPT_NAME'] . "?" . $_SERVER['QUERY_STRING']; ?>">
<table width=100%>
<tr>
<td>
<input type="checkbox" name"Reason" value="Photo is too dark">Photo is too dark
</td>
</tr>
<tr>
<td>
<input type="checkbox" name"Reason" value="Photo is blurred low resolution">Photo is blurred low resolution
</td>
</tr>
<tr>
<td>
<input type="checkbox" name"Reason" value="Photo is not cropped properly">Photo is not cropped properly
</td>
</tr>
<tr>
<td>
<input type="checkbox" name"Reason" value="Not a roster type photo">Not a roster type photo
</td>
</tr>
<tr>
<td>
<input type="checkbox" name"Reason" value="Duplicate photo">Duplicate photo
</td>
</tr>
<tr>
<td>
<input type="checkbox" name"Reason" value="Unable to see entire locomotive, may be partially blocked">Unable to see entire locomotive, may be partially blocked
</td>
</tr>
<tr>
<td>

Reason:<textarea name="Other" rows="10" style="width: 100%;"></textarea>
</td></tr>
<tr><td>
<input name="PhotoID" type="hidden" value="<? print $PhotoID; ?>">
<input name="Accept" type="hidden" value="<? print $Accept; ?>">
<input type="submit" name="Reject" value="Reject">
<input name="hidSubmit" type="hidden" id="hidSubmit2" value="true">
</td></tr>
</table>
</form>
<?
require ("Footer.php");
exit;
} else {



$strReason="";
$count=count($Reason);
for($i=0;$i<$count;$i++){$strReason="$strReason$Reason[$i]<br>";}


mail("email", "Your photo has been deleted", "
Hello $FirstName,

Your photo has been deleted for the following reason(s):

--------------------------------------
$strReason
$Other
--------------------------------------

We encourage you to correct the problem and resubmit your photo. If you think this was in error, please reply to this email with your reason as well as attach the photo.

", "From: Webmaster@LocoPhotos.com");



}
 
I must be doing something really dumb. I have switched those form fields from regualar variables to arrays and back. I cant even get the variables to pass straight thru. Do I have the form right? This is something I have done before and dont remember having any problems. I am pretty sure this is a pretty simple task...but I sure cant get it today.

Thanks for any help!

~Matthew
 
How about adding an equal sign for your checkbox names:

Code:
change:
 <input type="checkbox" name"Reason" value="Photo is too dark">Photo is too dark
to
 <input type="checkbox" name[red]=[/red]"Reason" value="Photo is too dark">Photo is too dark

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I was just about to come back and tell everyone how much of an idiot I was, I found it on my own just minutes ago. Talk about frustrating. LOL

Thanks for the help!!!

~Matthew
 
Your welcome.


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Sorry got submitted too soon.

These things happen, sometimes its the stupid things that get you.




----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top