ben_johnson1991 Posted October 18, 2009 Share Posted October 18, 2009 Hey, im new to php. Basically I have made a form to request which type of job(s) are needed, which when filled will then be sent to an email address. The problem im having is that when more than 1 checkbox is ticked, the mailto only sends 1 of the checkedboxes. My script for the checkboxes are::::::: <span class="label"><span class="labelred">*</span>Job type:</span> <label> <input type="checkbox" name="job" value="paper" id="job_0" /> Paper Hanging</label> <br /> <div style="margin-left:270px";><label> <input type="checkbox" name="job" value="painting" id="job_1" /> Painting</label> <br /> <label> <input type="checkbox" name="job" value="insurance" id="job_2" /> Insurance Work</label> </div> -------------------------------------------------------------- My mailto script for this section is basically: $_job = $_REQUEST['job'].. How do i request an individual job ID? or make the name of the checkboxes 'job' to include all th checked items in to the main body of the email? Just so you know, in the body of the email, i simply have the $job variable added into it. Any help would be greatful, it cant be that hard, but i have no idea! Cheers!! Link to comment https://forums.phpfreaks.com/topic/178145-checkbox-info-wont-include-in-mailto/ Share on other sites More sharing options...
ialsoagree Posted October 18, 2009 Share Posted October 18, 2009 You've declared each of your check boxes with the attribute name="job". This means that each check box is going to overwrite the setting of the one before it (because PHP only makes one 'job' index, not one for each check box). There's a few solutions, but they all start with changing the name= attribute. If you're comfortable with arrays and the for each loop, you could change the attribute to name="job[]" which tells PHP to make an array with each of the job check box values saved separately. Or you could just name then different things (like job1, job2, job3). Link to comment https://forums.phpfreaks.com/topic/178145-checkbox-info-wont-include-in-mailto/#findComment-939346 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.