GreenSmurf Posted June 13, 2008 Share Posted June 13, 2008 If I used $to_email= $_REQUEST['email']; and $to_email then equalled this string, "[email protected] [email protected] [email protected]" How would I extract the first email from the string then the second so on and so fourth while inside of a loop? -Brandon Link to comment https://forums.phpfreaks.com/topic/110130-solved-string-help/ Share on other sites More sharing options...
MatthewJ Posted June 13, 2008 Share Posted June 13, 2008 explode(" ", $to_email); Then the three addresses would be in $to_email[0], $to_email[1], $to_email[2] Hope that helps Link to comment https://forums.phpfreaks.com/topic/110130-solved-string-help/#findComment-565187 Share on other sites More sharing options...
GreenSmurf Posted June 13, 2008 Author Share Posted June 13, 2008 It does. I will look documentation on explode() and try to incorporate it. Thank you. If I have problems I will post again. -Brandon Link to comment https://forums.phpfreaks.com/topic/110130-solved-string-help/#findComment-565190 Share on other sites More sharing options...
GreenSmurf Posted June 13, 2008 Author Share Posted June 13, 2008 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 More sharing options...
GreenSmurf Posted June 13, 2008 Author Share Posted June 13, 2008 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 More sharing options...
DarkWater Posted June 13, 2008 Share Posted June 13, 2008 I swear that hardly anyone knows how to ask questions any more. WHICH error? =/ Link to comment https://forums.phpfreaks.com/topic/110130-solved-string-help/#findComment-565263 Share on other sites More sharing options...
GreenSmurf Posted June 13, 2008 Author Share Posted June 13, 2008 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 More sharing options...
kenrbnsn Posted June 13, 2008 Share Posted June 13, 2008 You need to echo the value <input type="hidden" name="email" value="<?php echo $email ?>"> Ken Link to comment https://forums.phpfreaks.com/topic/110130-solved-string-help/#findComment-565274 Share on other sites More sharing options...
GreenSmurf Posted June 13, 2008 Author Share Posted June 13, 2008 Thank you. I also found that if you use the disable property in the <textarea> it works fine as well or with the type="text" parameter readonly work well as a proterty. -Brandon Link to comment https://forums.phpfreaks.com/topic/110130-solved-string-help/#findComment-565281 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.