Jump to content

[SOLVED] String Help


GreenSmurf

Recommended Posts

Seems to be having a problem getting the while loop to work. I have echo setup to show variables being passed and it seems that the line of code:

 

echo "$my_email || $to_email[$i] || $e_subject || $message<br><br>";

 

Is not outputting anything.

 

$my_email = $_REQUEST["myemail"];
$e_subject = $_REQUEST["subject"];
$email = $_REQUEST["email"];
$message = $_REQUEST["comments"];
$resultsnumber = $_REQUEST["resultsnumber"];

$to_email = explode(" ", $email);
for($i = 0; $i < count($to_mail); $i++){
echo "$my_email || $to_email[$i] || $e_subject || $message<br><br>";

if (isset($myemail)){
   if (isset($to_email[$i])){
      if (!isset($e_subject) OR !isset($message)){
         echo "Subject or body of e-mail left blank.";
      }
      else {
           mail($to_email[$i],$e_subject,$message,"From: $my_email");
           
           echo "Mail sent." ;
     }
  }
  else {
    echo " Recipient e-mail was left blank.";
  }
}
else {
     echo "Your e-mail was not entered properly.";
}
}

 

Any suggestion as to what I did wrong?

 

-Brandon

Link to comment
https://forums.phpfreaks.com/topic/110130-solved-string-help/#findComment-565207
Share on other sites

New code, new error.

$myemail = $_REQUEST["myemail"];
$subject = $_REQUEST["subject"];
$email = $_REQUEST["email"];
$comments = $_REQUEST["comments"];

$to_email = explode(" ", $email);

for($i = 0; $i < count($to_email); $i++){
  echo $to_email[$i]."<br>";
  if (isset($myemail)){
   if (isset($to_email[$i])){
      if (!isset($e_subject) OR !isset($message)){
         echo "Subject or body of e-mail left blank.";
      }
      else {
           mail($to_email[$i],$subject,$comments,"From: $myemail");
           
           echo "Mail sent to".$to_email[$i].".<br>";
     }
  }
    else {
      echo " Recipient e-mail was left blank.";
    }
  }
  else {
     echo "Your e-mail was not entered properly.";
  }
}

 

Any suggestions?

 

-Brandon

Link to comment
https://forums.phpfreaks.com/topic/110130-solved-string-help/#findComment-565252
Share on other sites

Excuse me but it slipped my mind. I was busy trying to fix it at the same time. The error was:

 

SMTP server response: 503 RCPT first (#5.5.1)

 

I found out it was because I was trying to submit a hidden value; like so,

<input type="hidden" name="email" value="<? $email ?>">

 

If you have any suggestions on how I can submit a value without it being editable by the user that wouls be awesome.

 

-Brandon

Link to comment
https://forums.phpfreaks.com/topic/110130-solved-string-help/#findComment-565270
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.