-
Posts
2,527 -
Joined
-
Last visited
Everything posted by DeanWhitehouse
-
bump.
-
ok, so it would be $to = "cake,monkey,spider"; // example not what i am using, $to = explode(",",$to); foreach ($to as $tos) { $mail->AddAddress($tos); }
-
Thanks, dude i was treating it like normal php mail() where you just add a , and thats it. Problem no.2 this is the bit where it gets told the recipient $mail->AddAddress($to[0]); $mail->AddAddress($to[1]); //$mail->AddAddress($to[2]); //$mail->AddAddress($to[3]); //$mail->AddAddress($to[4]); now, this won't send if there is nothing in array($to) 2,3 etc. so how i can i get it to only have the address when there is that amount, without writing an if statement for each one. e.g. i know i could od if(count($to) == 2) { $mail etc. } but is there a quicker way?
-
This is my code for my loader // JavaScript Document <!-- if (document.images) { pic1= new Image(); pic1.src="loader.gif"; } document.getElementById('main').style.visibility="hidden"; function loading() { document.getElementById("main").style.visibility="visible"; document.getElementById('loader').style.visibility="hidden"; document.getElementById('loader').style.marginTop="0%"; document.body.style.backgroundColor="#CCCCCC"; document.getElementById('loader').innerHTML = ' '; } //--> and this is the html side <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" media="screen" href="style.css"> <title>Mail App</title> <style type="text/css"> body { visibility:hidden; background-color:#000000; } .test { visibility:visible; margin-top:25%; } </style> <script type="text/javascript" src="main.js"></script> </head> <body onLoad="loading()"> <div id="loader" align="center" class="test"> <h1>Loading</h1> <br /><img src="loading.gif" alt="loading" align="absmiddle"></div> <div align="center" id="main"> <form action="mailapp.php" method="post" > To :<input type="text" value="" name="to" size="30" title="Enter The Recipients Email Address"> From :<input type="text" value="" name="from" size="30" title="Enter Your Email"> Subject :<input type="text" value="Enter A Subject" name="subject" size="30" title="Enter The Email Subject"> Message: <textarea title="Enter Your Message" name="message" rows="10" cols="100">Enter Your message here</textarea> <input type="submit" name="send" value="Send" title="Send The Email" size="30"> </form> </div> </div> </body> </html> And with this code , i don't think it is very effienct or very good, is there any ways to improve it, and is there any way that i can have this only run the function once, as the form is posting to its self i don't want it loading each time.
-
BUMP this is the address of my page http://djw-webdesign.awardspace.com/Mail%20App/mailapp.php I have tried putting in a , but that didn't work. Does anyone have any idea?
-
Ok, thanks. An anwser to no.1 is because i am eventually going to be putting all the emails($to) in the database. but i still don't know now why i am exploding as i can enter them as one. And can you explain how i would do the while loop for the error checking , and the posted vars.
-
I have this mail code, and i was wondering if anyone could help make it a bit shorter. I believe there is a easier to way to display the errors? <?php session_start(); include("phpmailer/class.phpmailer.php"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" media="screen" href="style.css"> <title>Mail App</title> <style type="text/css"> body { visibility:hidden; background-color:#000000; } .test { visibility:visible; margin-top:25%; } </style> <script type="text/javascript" src="main.js"></script> </head> <body onLoad="loading()"> <div id="loader" align="center" class="test"> <h1>Loading</h1> <br /><img src="loading.gif" alt="loading" align="absmiddle"></div> <div align="center" id="main"> <?php //set some variables for the form $to = "Enter An Email"; $subject = "Enter A Subject"; $from = "Enter Your Email"; $message = "Enter Your message here"; //first off check if they have posted if(isset($_POST['send'])) { $to = htmlspecialchars($_POST['to']); $to = explode(",",$to); $count = count($to); if($count <=1) { $go = $to[0]; } if($count == 2) { $go = $to[0].","; $go .= $to[1]; } if($count == 3) { $go = $to[0].","; $go .= $to[1].","; $go .= $to[2]; } if($count == 4) { $go = $to[0].","; $go .= $to[1].","; $go .= $to[2].","; $go .= $to[3]; } if($count == 4) { $go = $to[0].","; $go .= $to[1].","; $go .= $to[2].","; $go .= $to[3].","; $go .= $to[4]; } echo $go; $subject = htmlspecialchars($_POST['subject']); $from = htmlspecialchars($_POST['from']); $message = htmlspecialchars($_POST['message']); $error = 0; if(strlen($go[0]) < 1) { echo "<h5>Please Enter A Recipient</h5>"; $error = 1; } elseif (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $go)) { echo "<h5>Invalid Recipient Email Address</h5>"; $error = 1; } if(strlen($from) < 1) { echo "<h5>Please Enter Your Email</h5>"; $error = 1; } elseif (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $from)) { echo "<h5>Your Email Address Appears To Be Invalid</h5>"; $error = 1; } if(strlen($subject) < 1) { echo "<h5>Please Enter A Subject</h5>"; $error = 1; } if(strlen($message) < 1) { echo "<h5>Please Enter A Message</h5>"; $error = 1; } if($error == 0) { $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "random-game-design.awardspace.com"; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "admin@random-game-design.awardspace.com"; // SMTP username $mail->Password = "Natasha"; // SMTP password $mail->From = $from; //do NOT fake header. $mail->FromName = $from; $mail->AddAddress($go); $mail->AddReplyTo($from, "Support and Help"); //optional $mail->Subject = $subject; $mail->Body = $message; if(!$mail->Send()) { echo $mail->ErrorInfo; }else{ echo "email was sent"; } } ?> <form action="mailapp.php" method="post" > <?php if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $go)) { ?> <font color="#FF0000"> To :<input type="text" value="<?php echo $go; ?>" name="to" size="30" style="border:#FF0000 thin solid;" title="Enter The Recipients Email Address"> </font> <?php } else { ?> To :<input type="text" value="<?php echo $go; ?>" name="to" size="30" title="Enter The Recipients Email Address"> <?php } if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $from)) { ?> <font color="#FF0000"> From :<input type="text" value="<?php echo $from; ?>" name="from" size="30" style="border:#FF0000 thin solid;" title="Enter Your Email"> </font> <?php } else { ?> From :<input type="text" value="<?php echo $from; ?>" name="from" size="30" title="Enter Your Email"> <?php } if(strlen($subject) == "") { ?> <font color="#FF0000"> Subject :<input type="text" value="<?php echo $subject; ?>" style=" border:#FF0000 thin solid;" name="subject" size="30" title="Enter The Email Subject"> </font> <?php } else { ?> Subject :<input type="text" value="<?php echo $subject; ?>" name="subject" size="30" title="Enter The Email Subject"> <?php } if(strlen($message) == "") { ?> <font color="#FF0000"> Message:<textarea title="Enter Your Message" name="message" rows="10" cols="100" style="border:#FF0000 thin solid;"><?php echo $message; ?></textarea> </font> <?php }else { ?> Message: <textarea title="Enter Your Message" name="message" rows="10" cols="100"><?php echo $message; ?></textarea> <?php } ?> <input type="submit" name="send" value="Send" title="Send The Email" size="30"> </form> </div> <?php } else { ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" > To :<input type="text" value="<?php echo $go; ?>" name="to" size="30" onClick="this.value=''" title="Enter The Recipients Email Address"> From :<input type="text" value="<?php echo $from; ?>" name="from" size="30" onClick="this.value=''" title="Enter Your Email"> Subject : <input type="text" value="<?php echo $subject; ?>" name="subject" size="30" onClick="this.value=''" title="Enter The Email Subject"> Message: <textarea title="Enter Your Message" name="message" onClick="this.value=''" rows="10" cols="100"><?php echo $message; ?></textarea> <input type="submit" name="send" value="Send" title="Send The Email" size="30"> </form> <?php } ?> </div> </body> </html>
-
Does anyone have experience using PHP Mailer , as i am currently stuck trying to send a message to multiple email addresses, does anyone know how to do this.
-
[SOLVED] Menu layer appears over lightbox photo - Need a Fix.
DeanWhitehouse replied to BAD311's topic in CSS Help
This should not be in the PHP section. -
which one. and click topic solved. please.
-
ok, thanks for all the reply's.
-
<?php if(isset($_POST['send'])) { $to = "one,two,three"; // i need to split one,two,three into $one $two $three } ?>
-
$_SERVER['REQUEST_URI'];
-
the data in the form. it will be user submitted.
-
Yer, i removed it , i first tried using strpbrk() but that is no longer used, i believe, then i tried using explode but that puts it in an array.
-
how can i seperate an input at (,) but not into an array.
-
how can i seperate a form input with that contains , and then insert into a database (i can do this bit). this is what i have so far. I tried exploding it, but if it is in an array how can i insert it into the db. if(isset($_POST['send'])) { $to = $_POST['to']; } ?> <!--<div id="title"><img src="title.jpg" alt="Title"></div>--> <div id="nav"></div> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" class="email"> To <input type="text" value="<?php echo $to; ?>" name="to" size="100" onClick="this.value=''" title="Enter The Recipients Email Address"> </form>
-
how to? ... #top #bottom #center such and such
DeanWhitehouse replied to plodos's topic in HTML Help
ahh ok, so you want a link like the back to top , links? -
how to? ... #top #bottom #center such and such
DeanWhitehouse replied to plodos's topic in HTML Help
i don't get what you mean. unless you mean this <a href="site">Site</a> -
i might be wrong but i think it should be mysql_query("UPDATE FlaxerAuthAndSig SET TotalHoursUsed = '$current_Hours'+1 WHERE username = '$user'");
-
how to? ... #top #bottom #center such and such
DeanWhitehouse replied to plodos's topic in HTML Help
this is the kinda thing. if(isset($_GET['#'])) { if($_GET['#'] == bulgaria) { //bulgaria code } } this the only way i can think of. -
Add a die statement to both your mysql_query
-
I might be able to help. I now JS, add me on deanwhitehouse6@hotmail.com
-
If it's a JS question bump in the JS forum, not this one.
-
It looks like ajax or maybe JS