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.

E-Mail php form

Featured Replies

Here is my code for my front end:

 

<html>

<head>

<title>Simple Feedback Form</title>

</head>

<body>

 

<form method="post" action="send_simpleform.php">

 

<p><strong>Your Name:</strong><br>

<input type="text" name="sender_name" size=30></p>

 

<p><strong>Your E-mail Address:</strong><br>

<input type="text" name="sender_name" size=30></p>

 

<p><strong>Message:</strong><br>

<textarea name="message" cols=30 rows=5 wrap=virtual></textarea></p>

 

<p><input type="submit" name="submit" value="Send This Form"></p>

 

</form>

</body>

</html>

 

And here's my back end:

 

<?php

if (($_POST[sender_name] == "") ||

($_POST[sender_email] == "") ||

($_POST[message] == "")) {

header("Location: simple_form.html");

exit;

}

 

$msg = "E-MAIL SNET FROM WWW SITE\n";

$msg .= "Sender's Name:\t$_POST[sender_name]\n";

$msg .= "Sender's E-Mail:\t$_POST[sender_email]\n";

$msg .= "Message:\t$_POST[message]\n";

 

$to = "dannon.trujillo@my.netech.edu";

 

$subject = "Web Site Feedback";

 

$mailheaders = "From: My Web Site <you@yourdomain.com>\n";

$mailheaders .= "Reply-To: $_POST[sender_email]\n";

 

mail($to, $subject, $msg, $mailheaders);

?>

 

<html>

<head>

<title>Simple Feedback Form Sent</title>

</head>

<body>

 

<h1>The following e-mail has been sent:</h1>

 

<p><strong>Your Name:</strong><br>

<?php echo "$_POST[sender_name]"; ?>

 

<p><strong>Your E-Mail Address:</strong><br>

<?php echo "$_POST[sender_email]"; ?>

 

<p><strong>Message:</strong><br>

<?php echo "$_POST[message]"; ?>

 

</body>

</html>

 

I am pretty sure it's something to do with my 18th line on my back end, but I'm not sure what to do with it.

Please help.

 

Thanks :)

Try this 'back end':

 

<?php
if (($_POST['sender_name'] == "") ||
($_POST['sender_email'] == "") ||
($_POST['message'] == "")) {
header("Location: simple_form.html");
exit;
}

$msg = "E-MAIL SNET FROM WWW SITE\n";
$msg .= "Sender's Name:\t{$_POST['sender_name']}\n";
$msg .= "Sender's E-Mail:\t{$_POST['sender_email']}\n";
$msg .= "Message:\t{$_POST['message']}\n";

$to = "dannon.trujillo@my.netech.edu";

$subject = "Web Site Feedback";

$mailheaders = "From: My Web Site <you@yourdomain.com>\n";
$mailheaders .= "Reply-To: {$_POST['sender_email']}\n";

mail($to, $subject, $msg, $mailheaders);
?>

<html>
<head>
<title>Simple Feedback Form Sent</title>
</head>
<body>

<h1>The following e-mail has been sent:</h1>

<p><strong>Your Name:</strong><br>
<?php echo $_POST['sender_name']; ?>

<p><strong>Your E-Mail Address:</strong><br>
<?php echo $_POST['sender_email']; ?>

<p><strong>Message:</strong><br>
<?php echo $_POST['message']; ?>

</body>
</html>

Edited by andyl

  • Author

I think i either did something else wrong or your php version is different. A lot of the stuff you put isn't in this php book.

 

Here is the new back end:

 

<?php

if (($_POST['sender_name'] == "") ||

($_POST['sender_email'] == "") ||

($_POST['message'] == "")) {

header("Location: simple_form.html");

exit;

}

 

$msg = "E-MAIL SENT FROM WWW SITE\n";

$msg .= "Sender's Name:\t{$_POST['sender_name]'}\n";

$msg .= "Sender's E-Mail:\t{$_POST['sender_email']}\n";

$msg .= "Message:\t{$_POST['message']}\n";

 

$to = "dannon.trujillo@my.netech.edu";

 

$subject = "Web Site Feedback";

 

$mailheaders = "From: My Web Site <you@yourdomain.com>\n";

$mailheaders .= "Reply-To: {$_POST['sender_email']}\n";

 

mail($to, $subject, $msg, $mailheaders);

?>

 

<html>

<head>

<title>Simple Feedback Form Sent</title>

</head>

<body>

 

<h1>The following e-mail has been sent:</h1>

 

<p><strong>Your Name:</strong><br>

<?php echo $_POST['sender_name']; ?>

 

<p><strong>Your E-Mail Address:</strong><br>

<?php echo $_POST['sender_email']; ?>

 

<p><strong>Message:</strong><br>

<?php echo $_POST['message']; ?>

 

</body>

</html>

  • 2 months later...

Hi,

 

In place of { } bracket you you simple ( ) bracket in the sender and receiver email lines with $_POST or $_REQUEST like $from = "From: $_POST['email']"; like this way and try it may solve the logical issue.

  • 2 weeks later...
  • Author

At the moment i'm working on something else. Don't worry about sending anymore messages for now. I'll look at it when i'm done here.

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.