Jump to content

unexpected T_FOR


dee19802000

Recommended Posts

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 = '[email protected]' ;    
   $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 <[email protected]>' . "\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>";

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/188558-unexpected-t_for/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/188558-unexpected-t_for/#findComment-995483
Share on other sites

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>

Link to comment
https://forums.phpfreaks.com/topic/188558-unexpected-t_for/#findComment-995492
Share on other sites

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 = '[email protected]' ;    
   $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 <[email protected]>' . "\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

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/188558-unexpected-t_for/#findComment-995493
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.