Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by chome4

  1. <form action="send.php" class="form-horizontal" id="contactForm" method="post" name="contactForm" style="width:100%"> <div class="form-group"> <label for="name">Name</label><br> <input id="name" name="name" type="text" placeholder="Your Name"> <span class="alert alert-danger e_name">*Name.</span> </div> <div class="form-group"> <label for="email">Email</label><br> <input id="email" name="email" type="email" placeholder="Your Email"> <span class="alert alert-danger e_email">*Email.</span> <span class="alert alert-danger e_email-1">*Email Validate !</span> </div> <div class="form-group"> <label for="email">CC</label><br> <input id="email" name="email" type="email" placeholder="CC (optional)"> <span class="alert alert-danger e_email">*Email.</span> <span class="alert alert-danger e_email-1">*Email Validate !</span> </div> <div class="form-group"> <label for="email">BCC</label><br> <input id="email" name="email" type="email" placeholder="BCC (optional)"> <span class="alert alert-danger e_email">*Email.</span> <span class="alert alert-danger e_email-1">*Email Validate !</span> </div> <div class="form-group"> <label for="subject">Subject</label><br> <input id="subject" name="subject" type="text" placeholder="Reason for Email"> <span class="alert alert-danger e_sub">*Subject.</span> </div> <div class="form-group"> <label for="subject">Message</label><br> <textarea class="textinput" cols="40" id="message" name="message" rows="10"></textarea> <span class="alert alert-danger e_mes">*Message.</span> </div> <div class="btn btn-info"> <a class="link" href="javascript:gonder();" id="btn">Send</a> </div> <div id="info"></div> </form>
  2. I want the form to have blank fields so the sender can optionally copy in others.
  3. Here is the code from a working contact form. I've seen "foreach ($mail_data['cc'] as $email => $name) { $driver->addCC($email, $name); }" ...but don't know anything about incorporating this into the code below. =============================================================================== <?php include 'phpmailer/class.phpmailer.php'; function GetIP(){ if(getenv("HTTP_CLIENT_IP")) { $ip = getenv("HTTP_CLIENT_IP"); }elseif(getenv("HTTP_X_FORWARDED_FOR")) { $ip = getenv("HTTP_X_FORWARDED_FOR"); if (strstr($ip, ',')) { $tmp = explode (',', $ip); $ip = trim($tmp[0]); } }else{ $ip = getenv("REMOTE_ADDR"); } return $ip; } $ip_adress = GetIP(); $name = addslashes(strip_tags($_POST['name'])); $sub = addslashes(strip_tags($_POST['subject'])); $email = addslashes(strip_tags($_POST['email'])); $message = addslashes(strip_tags($_POST['message'])); if(empty($name) || empty($email) || empty($message) || empty($sub)){header("Location:form.php?empty"); }else{ $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "smtp.****.com"; // smtp host $mail->Port = "587"; //587 // Port $mail->SMTPAuth = true; $mail->Username = ******"; //mail address $mail->Password = "******"; //email password $mail->From = "******"; // from mail address $mail->Fromname = "no-reply"; // From Name $mail->AddAddress("*****","no name"); //your mail address and name $mail->WordWrap = 50; $mail->Subject = $sub; // Mail Subject $mail->Body = " Name : ".$name. " <br>E-mail: ".$email. " <br>Message: ".$message . " <br>IP : ".$ip_adress ; $mail->AddReplyTo($email,"Contact Form"); $mail->AddAddress('******'); //mail address $mail->IsHTML(true); if($mail->Send()) echo ""; } ?>
  4. I'm not a PHP programmer but have successfully used PHPMailer to set up a form that works by using pre-written code available out there. I've been asked to modify a contact form that has an extra empty 'CC' field. I can do that! But how can I make this blank field accept any email address so another person can be copied in. There doesn't seem to be any help, with examples. Thanks...
  5. Got some code from a tutorial that didn't work but managed to get rid of error messages. Now, when I upload the first image, it display with any text I type. Same with other images - but if I click 'upload image', a blank image space appears. I'd like to know how to stop this 'phantom' uploading along with a message: 'Please select an image' <?php $msg = ""; if (isset($_POST['upload'])){ $target = "images/".basename($_FILES['image']['name']); $db = mysqli_connect("localhost","root","","photos"); $image = $_FILES['image']['name']; $text = $_POST['text']; $sql = "INSERT INTO images (image, text) VALUES ('$image', '$text')"; mysqli_query($db, $sql); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $msg = "Image uploaded"; }else{ $msg = "There was a problem"; } $result = mysqli_query($db, "SELECT * FROM images"); } ?> <!DOCTYPE html> <html> <head> <title>Image Upload</title> <style type="text/css"> #content{ width: 50%; margin: 20px auto; border: 1px solid #cbcbcb; } form{ width: 50%; margin: 20px auto; } form div{ margin-top: 5px; } #img_div{ width: 80%; padding: 5px; margin: 15px auto; border: 1px solid #cbcbcb; } #img_div:after{ content: ""; display: block; clear: both; } img{ float: left; margin: 5px; width: 300px; height: 140px; } </style> </head> <body> <div id="content"> <?php $db = mysqli_connect("localhost","root","","photos"); $sql = "SELECT * FROM images"; $result = mysqli_query($db, $sql); while ($row = mysqli_fetch_array($result)) { echo "<div id='img_div'>"; echo "<img src='images/".$row['image']."' >"; echo "<p>".$row['text']."</p>"; echo "</div>"; } ?> <form method="post" action="index.php" enctype="multipart/form-data"> <input type="hidden" name="size" value="1000000"> <div> <input type="file" name="image"> </div> <div> <textarea name="text" cols="40" rows="4" placeholder="Say something"></textarea> </div> <div> <input type="submit" name="upload" value="upload Image"> </div> <!--<div> <button type="submit" name="upload">POST</button> </div>--> </form> </div> </body> </html> I called my database 'photos' and the table 'images' with 'id (primary, auto_increment)', 'image' and 'text'. Thanks in advance.
  6. A further development: I specified a gmail address when I filled-in the registration form and the verify email's link was clickable. Seems that the issue lies with the Yahoo side of things!
  7. I've uploaded everything into a .org domain and the result is the same. Strange.
  8. I've tried several tutorials on registrations and, apart from the one I'm now using, they've contained errors and the creators haven't responded. But at least two of them did produce clickable links - unfortunately, I deleted the folders containing the code! I've since read that it's best to retain a non-clickable link as an option as not all systems can handle actual links.
  9. Working through a 'register/login with verify' script to make it work for my setup, and it does! Unfortunately, the email asking me to verify my form details doesn't have a clickable link, just a url that I can copy/paste and get into the page. The original line of code from the script reads: $url = 'http://'.$_SERVER['SERVER_NAME'].'/property7/register/verify.php?id='.$lastId.'&token='.$token; And, following some instructions from another source, I change it to: $url = 'http://'.$_SERVER['SERVER_NAME'].'/property7/register/verify.php?id='.$lastId.'&token='.$token; $url_components = parse_url($url); parse_str($url_components['query'], $params); But it gave the same result, image attached. Can someone inform me as to what to do to get the link in the email to appear in link form so I can maybe turn it into a button? Thanks in advance.
  10. The contact form actually works! Here's a link to the full site from which it comes: http://test.ericfinlayartist.co.uk/ I've removed my email but just tested it and it works, no confirmation, of course. Yes, I just want a line of text. I can format it with CSS later. Yep, still learning, but have been asked to help a friend out who wants the site. She understands!
  11. Got this working script that sends email via a form: <?php if(empty($_POST) === false) { $errors = array(); $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; if(empty($name) === true || empty($email) === true || empty($message) === true) { $errors[] = 'name, email and message are required!'; } else { if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) { $errors[] = 'Not valid email'; } if (ctype_alpha($name) === false) { $errors[] = 'name contain letters!'; } } if(empty($errors) === true) { mail('XXXXXXX@gmail.com','contact form',$message, 'From: '.$email); header('Location: index.php?sent'); exit(); } } ?> Problem is, I want a bar to appear saying 'Message Sent. We Will Contact You Shortly'. I'm brand new to php and followed a tutorial for the above. It's a simple form that I understand, apart from the code needed for confirmation! Please can someone offer any assistance. Thanks in advance......
  • 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.