Jump to content

Parse error: syntax error..... with an email script to multiple reciepitents


blink359

Recommended Posts

I tried to use this code that i wrote after being told the while statement to use and got

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a9855336/public_html/massemail.php on line 38

Here is the code it includes the line numbers as this is not the full .php file as the rest of it is the ccs links etc

26      <form action="mail.php" method="post">
27      <p>From:<br />
28         <input type="text" name="from" />@example.co.uk<br />
29        Subject:<br />
30          <input type="text" name="subject" /><br />
31        Message:<br /><textarea rows="10" cols="50" name="message" /></textarea><br />
32        <input type="submit" /></p></form></p>
33        <?
34 $result = mysql_query("SELECT email FROM mail);
35
36 while ($row = mysql_query($result)) //this takes all email out of database and puts them in the "to" part
37 {  
38	$to = '$row['email'] ,';
39
40 $subject = $_POST['subject'];
41 $message = $_POST['message'];
42 $from = $_POST['from']@example.co.uk;
43 mail('$to', '$subject', '$message', null,
44   '-$from');
45
46 ?>
        

Thanks

 

Blink359

Link to comment
Share on other sites

still get Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a9855336/public_html/massemail.php on line 39 even with

$result = mysql_query("SELECT email FROM mail);

while ($row = mysql_query($result)) 
{ 
$to = $row['email'];

Link to comment
Share on other sites

Why you used @ in line number 42 ?

 

while ($row = mysql_query($result)) //this takes all email out of database and puts them in the "to" part
{ 
$to = $row['email'];

$subject = $_POST['subject'];
$message = $_POST['message'];
$mailid = $_POST['from'];
$from = "$mailid@example.co.uk";
mail('$to', '$subject', '$message', null,'-$from');

Link to comment
Share on other sites

      <?
$result = mysql_query("SELECT email FROM mail);

while ($row = mysql_query($result)) 
{ 
$to = $row['email'];

$subject = $_POST['subject'];
$message = $_POST['message'];
$from = $_POST['from']@example.co.uk;
mail('$to', '$subject', '$message', null,
   '-$from');
?>

Say $_POST['from'] was blink359 i wanted to add @example.co.uk on the end thought it might work obviously not?

Link to comment
Share on other sites

I wish it was working now so you didnt have to help me anymore but it isnt >.<

i may have missed something

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a9855336/public_html/massemail.php  on line 41

 

36      <?
37$mailid = $_POST['from'];
38
39$result = mysql_query("SELECT email FROM mail);
40
41while ($row = mysql_fetch_array($result))  
42{ 
43$to = $row['email'];
44
45$subject = $_POST['subject'];
46$message = $_POST['message'];
47$from = "$mailid@example.co.uk";
48mail('$to', '$subject', '$message', null,
49   '-$from');
50
51?>

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.