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 Problem

Featured Replies

Hey guys, new to the site (Hello!) Wondered if you could give me a few pointers in the right direction...

 

I have been playing with this PHP contact form, but cant seem to get it working. Whenever I click submit it just shows the error page. I have removed all validation to eliminate that. Would any of you mind taking a quick look for me if you get chance?

 

The form can be seen here and this is the PHP script I am using;

 

<?php
$EmailFrom = "Site Quote";
$EmailTo = "j.cresse@hgkcomputers.co.uk";
$Subject = "Price Quote";


// email body
$Body = "";
$Body .= "Number of Pages Required: ";
$Body .= $no_pages;
$Body .= "\n";
$Body .= "Animation required?: ";
$Body .= $animation;
$Body .= "\n";
$Body .= "Animation Length: ";
$Body .= $animationLength;
$Body .= "\n";
$Body .= "Number of images required: ";
$Body .= $pictures;
$Body .= "\n";
$Body .= "Number of forms required: ";
$Body .= $number_forms;
$Body .= "\n";
$Body .= "Number of videos required: ";
$Body .= $videos;
$Body .= "\n";
$Body .= "Password pages required: ";
$Body .= $password;
$Body .= "\n";
$Body .= "Number of flash pages required: ";
$Body .= $flash;
$Body .= "\n";
$Body .= "eCommerce Required?: ";
$Body .= $basket;
$Body .= "\n";
$Body .= "Domain required: ";
$Body .= $domain;
$Body .= "\n";
$Body .= "Hosting required: ";
$Body .= $hosting;
$Body .= "\n";
$Body .= "Number of email addressed required: ";
$Body .= $numberEmail;
$Body .= "\n";


// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// success page
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=pricing_temp.html\">";
}
else{
 print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>

 

This is my 1st attempted at coding in PHP, I've probably missed something so basic out (lol) so go easy on me!

 

Thanks in advanced

Jay

  • Author
What error message do you get?

 

Just goes straight to the error.html I use in the else statement, no actual error as such, and nothing gets to my inbox (or junk mail) :rolleyes:

This means that the email is not being sent, and is usually caused by the fact you don't have a mail server installed!

  • Author
This means that the email is not being sent, and is usually caused by the fact you don't have a mail server installed!

 

Thanks mate, I need to check this with my host, I'm sure they would have something in place for such scripts...

 

Apart from that does the coding look ok?

 

Cheers

Looks ok. But I'd recommend that you use an HTTP header to redirect the user instead of the META refresh. More reliable.

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.