Jump to content

ArrudaC

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by ArrudaC

  1. Hi. After adding all the pho code to the form page (index.php), the data entered no longer gets sent over by email. The thankyou page still shows up and it catches the forms field title-fname-lname, but no email. Below is a copy of my form page now; <?php $to = $_REQUEST['qtype']; $from = $_REQUEST['email']; $title = $_REQUEST['title']; $fname = $_REQUEST['fname']; $lname = $_REQUEST['lname']; $message = $_REQUEST["formes"]; $error_message = ""; $title = ""; $fname = ""; $lname = ""; $qtype = ""; $formes = ""; if(isset($_POST['submit'])){ $title = $_POST['title']; $fname = $_POST['lname']; $lname = $_POST['lname']; $qtype = $_POST['qtype']; $formes = $_POST['formes']; if(empty($title)|| empty($fname)|| empty($lname)|| empty($qtype)|| empty($formes)){ $error_message = "* All fields are required!"; } } $headers = "From: $from"; $subject = "Web Contact Data."; $date = date("j F Y"); $time = date("g:i A"); $fields = array (); $fields{"fname"} = "First Name"; $fields{"lname"} = "Last Name"; $fields{"email"} = "E-Mail"; $fields{"qtype"} = "Querie Type"; $fields{"formes"} = "Customer's message"; $headers2 = "From: [email protected]"; $subject2 = "$fname, we have received your query."; $autoreply = "Dear $title $lname, $firnam, Thank you for contacting us. We will get back to you as soon as possible, usually within 6 hours. If you have any more questions, please consult our website at www.test.co.uk. Here is a copy of your message: ------------------------------------------------------------------------------- $message ------------------------------------------------------------------------------- Have you got this e-mail by mistake? If so, please do let us know by e-mailing us at [email protected]. This is an unmonitored mail box. Please do not reply to this e-mail. kind regards, Customer Care Dep. Date: $date Time: $time"; $body ="We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a],$date);} $body .= $date; $body .= $time; switch($_REQUEST['qtype']) { case 'Feedback': $to = '[email protected]'; break; case 'Website': $to = '[email protected]'; break; case 'Complaint': $to = '[email protected]'; break; case 'Other': $to = '[email protected]'; break; } $send = mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>FormTest</title> <link href="css/FW2.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="formwraper"><!--div form start--> <form id="form" name="form" action="thankyou.php" method="post"> <select id="title" name="title"> <option value="" disabled="disabled" selected="selected">Title...</option> <option value="Mr">Mr</option> <option value="Mrs">Mrs</option> <option value="Ms">Ms</option> <option value="Miss">Miss</option> </select> <input id="fname" name="fname" placeholder="First name..." /> <input id="lname" name="lname" placeholder="Last name..." /> <select id="qtype" name="qtype"> <option value="" disabled="disabled" selected="selected">Query type...</option> <option value="Feedback">Feedback</option> <option value="Website">Website</option> <option value="Complaint">Complaint</option> <option value="Other">Other</option> </select> <input id="email" name="email" placeholder="Your email..." /> <textarea id="formes" name="formes" placeholder="Your message here. We value your privacy."></textarea> <p id="errmes"><?php echo $error_message; ?></p> <input class="formbtn" name="subform" type="submit" value="Send" /> <input class="formbtn" name="resform" type="reset" value="Clear" /> </form> </div><!--div form end--> </body> Below is a copy of the thankyou page code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>FormTest</title> <link href="css/FW2.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="thankswraper"><!--div form start--> <p> </p> <p> </p> <p><img src="pics/invio-email.png" width="88" height="78" /></p> <p> </p> <p> </p> <p>Hello <?php print stripslashes($_REQUEST['title']. " " . $_REQUEST['fname']. " ". $_REQUEST['lname']); ?>. <br /> <br /> Your message was successfully sent. </p> </p> <p> </p> <p>We will do our best to reply within 1 working day.<br /> <br /> Thank you for contacting us. <p id="goback"><a href="index.php">Go back</a><br /> </div><!--div form end--> </body> What am I doing wrong please? Anyone? Kind regards, Albert
  2. HI requinix. As I have mentioned I am not a coder and all that I have achieved was by finding some code and try to change it to suit my needs, sorry. I always thought that the php code to send the form data was ment to be in the thank you page. I'll give it a nother go and have all the php code in the form page. Many thanks. Regards, Albert
  3. Hi all. I have a working webform. It neither provides security nor does it provide data validation. At the moment, it's data validation I am looking to achieve. I have seen a few youtube videos and bellow is the resulting code (additions to working code); <?php $error_message = ""; $title = ""; $fname = ""; $lname = ""; $qtype = ""; $formes = ""; if(isset($_POST['submit'])){ $title = $_POST['title']; $fname = $_POST['lname']; $lname = $_POST['lname']; $qtype = $_POST['qtype']; $formes = $_POST['formes']; if(empty($title)|| empty($fname)|| empty($lname)|| empty($qtype)|| empty($formes)){ $error_message = "* All fields are required!"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>FormTest</title> <link href="css/FW2.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="formwraper"><!--div form start--> <form id="form" name="form" action="thankyou.php" method="post"> <select id="title" name="title"> <option value="" disabled="disabled" selected="selected">Title...</option> <option value="Mr">Mr</option> <option value="Mrs">Mrs</option> <option value="Ms">Ms</option> <option value="Miss">Miss</option> </select> <input id="fname" name="fname" placeholder="First name..." /> <input id="lname" name="lname" placeholder="Last name..." /> <select id="qtype" name="qtype"> <option value="" disabled="disabled" selected="selected">Query type...</option> <option value="Feedback">Feedback</option> <option value="Website">Website</option> <option value="Complaint">Complaint</option> <option value="Other">Other</option> </select> <input id="email" name="email" placeholder="Your email..." /> <textarea id="formes" name="formes" placeholder="Your message here. We value your privacy."></textarea> <p id="errmes"><?php echo $error_message; ?></p> <input class="formbtn" name="subform" type="submit" value="Send" /> <input class="formbtn" name="resform" type="reset" value="Clear" /> </form> </div><!--div form end--> </body> From what I have seen on one of the videos, it would be great to have the error message being displayed on the form itself, in an available area, hence the id=errmes which will be controlled by CSS for correct positioning. The issue I am now facing is that the form still works and sends the data across but regardless of validation so, in other words, my changes to the code have resulted in nothing. What am I doing wrong here? Any help much appreciated. Bellow is the code for the thankyou page. <?php $to = $_REQUEST['qtype']; $from = $_REQUEST['email']; $title = $_REQUEST['title']; $fname = $_REQUEST['fname']; $lname = $_REQUEST['lname']; $message = $_REQUEST["formes"]; $headers = "From: $from"; $subject = "Web Contact Data."; $date = date("j F Y"); $time = date("g:i A"); $fields = array (); $fields{"fname"} = "First Name"; $fields{"lname"} = "Last Name"; $fields{"email"} = "E-Mail"; $fields{"qtype"} = "Querie Type"; $fields{"formes"} = "Customer's message"; $headers2 = "From: [email protected]"; $subject2 = "$fname, we have received your query."; $autoreply = "Dear $title $lname, $firnam, Thank you for contacting us. We will get back to you as soon as possible, usually within 6 hours. If you have any more questions, please consult our website at www.test.co.uk. Here is a copy of your message: ------------------------------------------------------------------------------- $message ------------------------------------------------------------------------------- Have you got this e-mail by mistake? If so, please do let us know by e-mailing us at [email protected]. This is an unmonitored mail box. Please do not reply to this e-mail. kind regards, Customer Care Dep. Date: $date Time: $time"; $body ="We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a],$date);} $body .= $date; $body .= $time; switch($_REQUEST['qtype']) { case 'Feedback': $to = '[email protected]'; break; case 'Website': $to = '[email protected]'; break; case 'Complaint': $to = [email protected]'; break; case 'Other': $to = '[email protected]'; break; } $send = mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>FormTest</title> <link href="css/FW2.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="thankswraper"><!--div form start--> <p> </p> <p> </p> <p><img src="pics/invio-email.png" width="88" height="78" /></p> <p> </p> <p> </p> <p>Hello <?php print stripslashes($_REQUEST['title']. " " . $_REQUEST['fname']. " ". $_REQUEST['lname']); ?>. <br /> <br /> Your message was successfully sent. </p> </p> <p> </p> <p>We will do our best to reply within 1 working day.<br /> <br /> Thank you for contacting us. <p id="goback"><a href="index.php">Go back</a><br /> </div><!--div form end--> </body> Many thanks. Albert
  4. Hi. After adding the extra php code to select the e-mail the form now does not send an acknowledgement to the user. My code is below. <?php switch($_REQUEST['bustype']) { case 'Guest House': $to = '[email protected]'; break; case 'Village Haul': $to = '[email protected]'; break; case 'Small Office': $to = '[email protected]'; break; case 'Medium Office': $to = '[email protected]'; break; case 'Hair Salon': $to = '[email protected]'; break; } $from = $_REQUEST['email']; $title = $_REQUEST['title']; $fname = $_REQUEST['firnam']; $lname = $_REQUEST['lasnam']; $message = $_REQUEST["frmmsg"]; $headers = "From: $from"; $subject = "Web Contact Data."; $date = date("j F Y"); $time = date("g:i A"); $fields = array (); $fields{"firnam"} = "First Name"; $fields{"lasnam"} = "Last Name"; $fields{"email"} = "E-Mail"; $fields{"possition"} = "Possition"; $fields{"bustype"} = "Business Type"; $fields{"foundus"} = "Found us on"; $fields{"frmmsg"} = "Customer's message"; $headers2 = "From: [email protected]"; $subject2 = "$fname, we have received your query."; $autoreply = "Dear $title $lname, $firnam, Thank you for contacting us. We will get back to you as soon as possible, usually within 6 hours. If you have any more questions, please consult our website at www.flamewatch.co.uk. Here is a copy of your message: ------------------------------------------------------------------------------- $message ------------------------------------------------------------------------------- Have you got this e-mail by mistake? If so, please do let us know by e-mailing us at [email protected]. Do you need a new computer? A computer part or upgrade? Please contact us on 0845 123 4567 for more information or a quotation. This is an unmonitored mail box. Please do not reply to this e-mail. kind regards, Customer Care Dep. Date: $date Time: $time"; $body ="We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a],$date);} $body .= $date; $body .= $time; $send = mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); ?> What have I done wrong with the added code? I am sure I have not implemented it as I should have done... Many thanks. Regards, Albert
  5. Hello <?php print stripslashes($_REQUEST['title']. " " . $_REQUEST['firnam']. " ". $_REQUEST['lasnam']); ?>. Works a treat the above. Only issue is the sender not receiving a copy of the e-mail now.... I must have done something wrong.
  6. &nbsp
  7. LOL... apologies, my spelling can be at times atrocious. One thing though their all joint together with no spaces. Many thanks.
  8. I have changed my code to include the php bit sugested above but now customer side is not receiving a copy of the form. <?php switch($_REQUEST['bustype']) { case 'Guest House': $to = '[email protected]'; break; case 'Village Haul': $to = '[email protected]'; break; case 'Small Office': $to = '[email protected]'; break; case 'Medium Office': $to = '[email protected]'; break; case 'Hair Salon': $to = '[email protected]'; break; } $from = $_REQUEST['email']; $title = $_REQUEST['title']; $fname = $_REQUEST['firnam']; $lname = $_REQUEST['lasnam']; $message = $_REQUEST["frmmsg"]; $headers = "From: $from"; $subject = "Web Contact Data."; $date = date("j F Y"); $time = date("g:i A"); $fields = array (); $fields{"firnam"} = "First Name"; $fields{"lasnam"} = "Last Name"; $fields{"email"} = "E-Mail"; $fields{"possition"} = "Possition"; $fields{"bustype"} = "Business Type"; $fields{"foundus"} = "Found us on"; $fields{"frmmsg"} = "Customer's message"; $headers2 = "From: [email protected]"; $subject2 = "$fname, we have received your query."; $autoreply = "Dear $title $lname, $firnam, I have removed the following from my existing code to add the new code; $to = $_REQUEST['bustype']; Was I wrong in doing so? Is this the culpride? Many thanks. Albert
  9. I was sure on how to change the HTML side of it but utterly clueless as to how to change the php to work. As I have said, sadly I am not a coder. At best, I take code (ops sorry) and change it or try to change it to what I need. Many thanks to all especially to cyberRobot. On another note, I have been dabling on this reply to include the title and lastname but I got, on my first attempt an violation php error of sort. <p><br /> Hello <?php print stripslashes($_REQUEST['firnam']); ?>. <br /> <br /> Your message was successfully sent to us. </p> my attempt bellow did not work... <p><br /> Hello <?php print stripslashes($_REQUEST['tytle']['firnam']['lasnam']); ?>. <br /> <br /> Your message was successfully sent to us. </p> Many thanks to all. Albert
  10. Many thanks. If I only knew how to make that happened. But still, I get what you are saying. I'll do some digging and see what I can find about it. Many thanks.
  11. So that I can get the correct data from the customer and new what type of business is, how do I separet the e-mail from it? I mean, I can use just one single e-mail where all queries are submited. I just used this form and twiked it as this form I have used it in the past on another project but never even realized this. Much appreciated for your input.
  12. Hi all. I have the following code; <?php $to = $_REQUEST['bustype']; $from = $_REQUEST['email']; $title = $_REQUEST['title']; $fname = $_REQUEST['firnam']; $lname = $_REQUEST['lasnam']; $message = $_REQUEST["frmmsg"]; $headers = "From: $from"; $subject = "Web Contact Data."; $date = date("j F Y"); $time = date("g:i A"); $fields = array (); $fields{"firnam"} = "First Name"; $fields{"lasnam"} = "Last Name"; $fields{"email"} = "E-Mail"; $fields{"possition"} = "Possition"; $fields{"bustype"} = "Business Type"; $fields{"foundus"} = "Found us on"; $fields{"frmmsg"} = "Customer's message"; $headers2 = "From: [email protected]"; $subject2 = "$fname, we have received your query."; $autoreply = "Dear $title $lname, $firnam, and... <select name="bustype" class="dropforopt"> <option value="" disabled="disabled" selected="selected">Type of business...</option> <option value="Guest House""[email protected]">Guest House</option> <option value="[email protected]""2">Village Haul</option> <option value="[email protected]""3">Small Office (up to 10 people)</option> <option value="[email protected]""4">Medium Office (up to 50 people)</option> <option value="[email protected]""5">Hair Salon</option> </select> I have already had a play at changing the code as seen in the red line above but now the form will send the data to the e-mail of who's requesting information but won't send it to who should provide the information. It will work if I choose Village Haul and so on but not if I pick the first option. Still, even when it worked, I wasn't receiving the type of business chosen. Instead I was receiving the e-mail that is attached to that option. How do I get over this issue please? What am I doing wrong? I am not a coder so my experience resumes to having some code and changing it as I need. Many thanks in advance. Regards, Albert
×
×
  • 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.