SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict einSTein's Avatar
    Join Date
    Aug 2006
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php syntax error

    this $message var is a variable of the message in the mail function but i have an error in the syntax the error in the first line where $message = "....."
    Code PHP:
    	$message[$i]="<table border="0" width="300" cellspacing="0" cellpadding="0" id="table1" align=center>
    		<tr>
    			<td width="138">Name</td>
    			<td>$name[$i]</td>
    		</tr>
    		<tr>
    			<td height="22" width="138">E-mail</td>
    			<td height="22">mail[$i]</td>
    		</tr>
    		<tr>
    			<td width="138">Link To View Profile</td>
    			<td>$user[$i]</td>
    		</tr>
    	</table>";

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Wrap the var in single quotes on this occassion.

    PHP Code:
    $message[$i]='<table border="0" width="300" cellspacing="0" cellpadding="0" 
    ....
            </tr>
        </table>'

    Another alternative is to escape all the double quotes.

    PHP Code:
    $message[$i]="<table border=\"0\" width=\"300\" cellspacing=\"0\" cellpadding=\"0\" 
    ....
            </tr>
        </table>"


  3. #3
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you do use single quotes, don't forget to break them around the variables:
    Code php:
    $message[$i]='<table border="0" width="300" cellspacing="0" cellpadding="0" id="table1" align=center>
            <tr>
                <td width="138">Name</td>
                <td>'.$name[$i].'</td> ';
    Saul


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •