March 21, 201016 yr Sure I'm missing something simple, but its driving me crazy. Have used this script once before and worked a treat |From what I can tell its not working at all, hitting the submit button does nothing, far as I can tell HTML <form class="formClass formClear" id="homePageFormContact" action="http://www.mydomain.com/ttm-wordpress/wp-content/themes/TTM/contactCallback.php" method="get"> <ul> <li><label for="name">Name</label></li> <li class="formSpace"><input type="text" name="name" id="name"/> <script type="text/javascript"> var f1 = new LiveValidation('name', { validMessage: "Thats great!"} ); f1.add( Validate.Presence, { failureMessage:"You can't leave me empty!" } ); </script></li> <li><label for="emailAddress">Email Address</label></li> <li class="formSpace"><input type="text" name="emailAddress" id='emailAddress'/> <script type="text/javascript"> var f1 = new LiveValidation('emailaddress', { validMessage: "Thats great!"} ); f1.add( Validate.Presence, { failureMessage: "You can't leave me empty!" } ); </script></li> <li><label for="contactNumber">Contact Number</label></li> <li><input type="text" name="contactNumber" id="contactNumber"/><script type="text/javascript"> var f1 = new LiveValidation('contactNumber', { validMessage: "Thats great!"} ); f1.add( Validate.Presence, { failureMessage: "You can't leave me empty!" } ); </script></li> <li><input type="button" id="submit" name="submit" value="Send" class="inputButton"/></li> </ul> </form> PHP <? $subject="Callback request"; $headers= "From: ".$_GET['emailAddress']."\n"; $headers.='Content-type: text/html; charset=iso-8859-1'; mail("name@mydomain.com", $subject, " <html> <head> <title>Contact letter</title> </head> <body> ".$_GET['name']." ".$_GET['emailAddress']." ".$_GET['contactNumber']." </body> </html>" , $headers); #echo "<meta http-equiv="refresh" content="0;URL=contact-sent.html">"; #echo ("Your message was successfully sent!"); #header('Location: contact-sent.html'); #echo "<meta http-equiv="Refresh" content="0;URL=ProfileViewNoJava.php?Updated=True">"; ?> <script> //resizeTo(300, 300) //window.close() //window.open ('contact-sent.html') window.location.href = "http://www.mydomain.com/sent"; </script> The name of the php file is contactCallback.php and is in the right place On a related note, is there any app, plugin etc? that I can use to see what php is actually being parsed?
March 21, 201016 yr I think your problem lies in your use of double and single quotes starting on line 4... There's a great contact form here http://www.webdesignerforum.co.uk/topic/7143-php-contact-form-xhtml-strict/
March 22, 201016 yr Author Thanks I tried making all my quotes single <? $subject='Callback request'; $headers= 'From: '.$_GET['emailAddress'].'\n'; $headers.='Content-type: text/html; charset=iso-8859-1'; mail('tai@tonguetiedmedia.com', $subject, '<html> <head> <title>Contact letter</title> </head> <body> '.$_GET['name'].' '.$_GET['emailAddress'].' '.$_GET['contactNumber'].' </body> </html>' , $headers); #echo '<meta http-equiv='refresh' content='0;URL=contact-sent.html'>'; #echo ('Your message was successfully sent!'); #header('Location: contact-sent.html'); #echo "<meta http-equiv="Refresh" content="0;URL=ProfileViewNoJava.php?Updated=True">"; ?> <script> //resizeTo(300, 300) //window.close() //window.open ('contact-sent.html') window.location.href = "http://www.tonguetiedmedia.com/services"; </script> But hasn't fixed the issue. Thanks for the link to the other contact form, however, this is as much about me learning as it is having a working form so I'm going to stick with the simple one I'm using for now. Any other thoughts on what the issue could be?
March 22, 201016 yr Author Yup, was something stupid. Had my button type set as type="button" when of course, it needed to be type="submit" Always the little things
March 22, 201016 yr Yup, was something stupid. Had my button type set as type="button" when of course, it needed to be type="submit" Always the little things I've also noticed ur just validating ur fields with javascript if someone turns this off it wont validate it will send the email even though the fields are blank u should validate with php also
Create an account or sign in to comment