ArmageDDon
New Member
To create various forms I'm using protoform.js, which fits most of my requirements nicely. But if the user checks more than one checkbox, only the first value is passed - not both.I have an idea how to fix it with an array, but that's as far as my knowledge of php goes. I'm probably wrong (I'm usually wrong and there's little point in stopping now). I'd really appreciate some assistance.Below is some of the code; I've stripped out code I feel is irrelevant so please let me know if more code is required.HTML:\[code\]<form action="send.php" method="post" id="contactform"> <div class="box-form"> <fieldset> <div> <label for="name_Req">Name</label> <input type="text" id="name_Req" name="name" title="Required!" /> </div> <div> <input type="checkbox" id="preference1_Req" name="preference" value="http://stackoverflow.com/questions/10561243/HMTL5"/> <span>HTML5</span> <input type="checkbox" id="preference2" name="preference" value="http://stackoverflow.com/questions/10561243/CSS3" /> <span>CSS3</span> </div>\[/code\]PHP:\[code\] $name = $_POST['name']; $preference = $_POST['preference']; if ( $preference > 1 ) { $preference = array [should a "for each" php equivalent go here? ]; } if ( $name=='') { echo "<p>Please complete all required fields.</p>"; } else {require("include/class.phpmailer.php");$mail = new PHPMailer();$mail->Body = " ----------------Contact Details--------------<br> Name: ".$name."<br> Interest: ".$preference."<br> Comments: ".$comments;\[/code\]MTIA!