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

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'];

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 = "[email protected]";
mail('$to', '$subject', '$message', null,'-$from');

      <?
$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?

But that still doesnt explain the line 39 problem :S

 

Have you checked my updated code? replace your email line with my 2 lines.

 

$mailid = $_POST['from'];
$from = "[email protected]";

 

meh... my web host has different line numbers than the same code on dreamweaver >.< line 39 on my web host is

while ($row = mysql_query($result))

<---- this part is still a problem

 

Just trying the above now

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 = "[email protected]";
48mail('$to', '$subject', '$message', null,
49   '-$from');
50
51?>

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.