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 = '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>";

 

 

 

Link to comment
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
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
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 = '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

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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