dee19802000 Posted January 15, 2010 Share Posted January 15, 2010 Hey, can somebody tell me what I am doing wrong here. I get this error Parse error: syntax error, unexpected T_FOR from this code $to = 'my@email.com' ; $subject = 'Sipfit Call Back Request ' . $_POST['name']; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Sipfit Call Back Request <info@sipfit.co.uk>' . "\r\n"; $headers .= "CC:".$_POST['email']."\r\n"; $message = "<table> <tr><td>Your Name</td><td align='left'>".$_POST['name']."</td></tr> <tr><td>Contact No</td><td align='left'>".$_POST['telephone']."</td></tr> <tr><td>E-Mail</td><td align='left'>".$_POST['email']."</td></tr> </table> <table> <tr><td><br><b>Which Sipfit Products are you interested in?:</b><br></td></tr> <tr><td>" . for($i = 0; $i<count($_POST["product_int"]); $i++){ echo "<ul><li>". $_POST["product_int"][$i] . "</li></ul>"} . "</td></tr> </table>"; Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 15, 2010 Share Posted January 15, 2010 You're attempting to place a for loop into a variable, this obviously would run into errors. Assign the variable previously, and add the result into your $message variable after. Quote Link to comment Share on other sites More sharing options...
Zane Posted January 15, 2010 Share Posted January 15, 2010 if you use a comma instead of a period your code will work. >" , for($i = 0; $i". $_POST["product_int"][$i] . ""} , " At least I'm pretty sure it will. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 15, 2010 Share Posted January 15, 2010 if you use a comma instead of a period your code will work. >" , for($i = 0; $i<count($_POST["product_int"]); $i++){ echo "<ul><li>". $_POST["product_int"][$i] . "</li></ul>"} , "< At least I'm pretty sure it will. Normally only echo would allow that construct. This would come up as an 'unexpected instanceof, AND, OR.. ' error instead. Quote Link to comment Share on other sites More sharing options...
dee19802000 Posted January 15, 2010 Author Share Posted January 15, 2010 nope that didnt work. Parse error: syntax error, unexpected ',' Dee Quote Link to comment Share on other sites More sharing options...
Zane Posted January 15, 2010 Share Posted January 15, 2010 Bummer... figured the comma would do it. Guess you'll have to do this $message = "</pre> <table> Your Name".$_POST['name']." Contact No".$_POST['telephone']." E-Mail".$_POST['email']." </table> <br> <table> Which Sipfit Products are you interested in?: "; for($i = 0; $i $message .= "". $_POST["product_int"][$i] . "\n"; } $message .= " </table> Quote Link to comment Share on other sites More sharing options...
dee19802000 Posted January 15, 2010 Author Share Posted January 15, 2010 I ended up doing as oni said, i declared the variable and added it to my message for($i = 0; $i<count($_POST["product_int"]); $i++) { $products = "<ul><li>". $_POST["product_int"][$i] . "</li></ul>"; } $to = 'me@email.com' ; $subject = 'Sipfit Call Back Request ' . $_POST['name']; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Sipfit Call Back Request <info@sipfit.co.uk>' . "\r\n"; $headers .= "CC:".$_POST['email']."\r\n"; $message = "<table> <tr><td><b>Your Name</b></td><td align='left'>".$_POST['name']."</td></tr> <tr><td><b>Contact No</b></td><td align='left'>".$_POST['telephone']."</td></tr> <tr><td><b>E-Mail</b></td><td align='left'>".$_POST['email']."</td></tr> </table> <table> <tr><td><br><b>Which Sipfit Products are you interested in?:</b><br></td></tr> </td><td>$products</td></tr> </table>"; Thanks for your help guys. Dee Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.