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.

A little PHP issue!

Featured Replies

Hi All,

 

I have the following two sets of code, the email send to my inbox but nothing is displayed on what the user has inputted.

What have I done wrong ??

 

HTML Form Code:

 

<form method="post" action="test1.php">
Name: <input name="nameField" type="text" size="25" />*<br />
<br />
Email: <input name="emailField" type="text" size="25" />*<br />
<br />
Phone: <input name="phoneField" type="text" size="25" /><br />
<br />
Type your message in the box below - *Required<br />
<textarea name="Body" cols="30" rows="5"></textarea><br />
<input name="Submit1" type="submit" value="Send" /> 
<input name="Reset1" type="reset" value="Reset" />

</form>

 

 

PHP Process Code:

 

<?php

/*Subject & Email Variables*/

$emailSubject = 'Website Form Feedback';
$webMaster = 'email@domain.com'; 

/*Gathering Variables*/

$emailField = $_POST['email'];
$nameField = $_POST['name'];
$phoneField = $_POST['phone'];
$commentsField = $_POST['comments'];

$body = <<<EOD
<br><br>
Name: $name <br>
Email: $email <br>
Phone: $phone <br>
Comments/Message: $comments <br><hr><br>
EOD;
/*Headers of the email*/
$headers = "From: $email\r\n";
$headers .="Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, 
$headers);

/*If email sent this variable will show*/

$theResults = <<<EOD
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
</style>
</head>
<body>
<p>Thank you.</p>
</body>
</html>
EOD;
echo "$theResults";

?>

 

Be gentle still learning, so has much info on what I have done wrong in plain english will be helpful.

 

Cheers.

lol... ok

 

$emailField is the variable that you put $_POST['email'] to... now look at the email message code... do you use $emailField or do you use $email?

 

hope you pick up on that :)

  • Author

Hi, Thanks, I have just picked up on that waiting for a reply on here lol

So just testing it now.

 

Thanks again

  • Author

Ok all works fine now!!! sorted it didnt realise i had different name variables....

"Type your message in the box below - *Required<br />"

 

The script you posted doesn't require anything unless you use $_REQUIRE.

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.