Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Php contact form not working

Featured Replies

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?

  • 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?

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.