i designed a simple php form which accepts the data and then displays it, (well its supposed to ) but its kinda not displaying the values it should..

<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>Email - ID: </strong><br>
<input type = "text" Name="sender_mail" 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>

The above is the normal html form and below i have included the php code

<?
  if(($_post[sender_name] == "") ||
     ($_post[sender_email]== "") ||
     ($_post[message] == "")) 
   {
      header("Location: simple_form.html");
      exit;
    }
$msg = "EMail sent from WWW site \n";
$msg .= "senders Name:\t $_post[sender_name]\n";
$msg .= "Sender's E-Mail:\t$_POST[sender_email]\n";
$msg .= "Message:\t$_POST[message]\n";
$to = "you@youremail.com";
$subject = "Web Site Feedback";
$mailheaders = "From: My Web Site <genericaddress@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>
<? echo "$_POST[sender_name]"; ?>
<P><strong>Your E-Mail Address:</strong><br>
<? echo "$_POST[sender_email]"; ?>

<P><strong>Message:</strong><br>
<? echo "$_POST[message]"; ?>

</BODY>
</HTML>

i have no idea why isnt the values being displayed...

you need to remove the double quotes either side of the $_POST[] and you need to put a single quote inside of the [].
Example

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

Its more the single quotes inside the array ([]) but i would remove the double quotes to make it look less cluttered.

well i did remove the double quotes and tries but still it aint printing nething.
the following is the php code

<?
  if(($_post[sender_name] == "") ||
     ($_post[sender_email]== "") ||
     ($_post[message] == "")) 
   {
      header("Location: simple_form.html");
      exit;
    }
$msg = EMail sent from WWW site \n;
$msg .= senders Name:\t $_post['sender_name']\n;
$msg .= Sender's E-Mail:\t$_POST['sender_email']\n;
$msg .= Message:\t$_POST['message']\n;
$to = "you@youremail.com";
$subject = "Web Site Feedback";
$mailheaders = "From: My Web Site <genericaddress@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>
<? echo $_POST['sender_name']; ?>
<P><strong>Your E-Mail Address:</strong><br>
<? echo $_POST['sender_email']; ?>
<P><strong>Message:</strong><br>
<? echo $_POST['message']; ?>

</BODY>
</HTML>

please remove the single quote at line number 11 near senders,i think it wil work.

nope it didnt work , i removed the single quote near senders...

try this once :

<?
if($_SERVER['REQUEST_METHOD']=='POST') {
  if(($_post[sender_name] == "") ||
     ($_post[sender_email]== "") ||
     ($_post[message] == "")) 
   {
      header("Location: simple_form.html");
      exit;
    }
$mail_body='$msg = EMail sent from WWW site \n;
$msg .= senders Name:\t $_post['sender_name']\n;
$msg .= Senders E-Mail:\t$_POST['sender_email']\n;
$msg .= Message:\t$_POST['message']\n;
$to = "you@youremail.com";
$subject = "Web Site Feedback";
$mailheaders = "From: My Web Site <genericaddress@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>
<? echo $_POST['sender_name']; ?>
<P><strong>Your E-Mail Address:</strong><br>
<? echo $_POST['sender_email']; ?>
<P><strong>Message:</strong><br>
<? echo $_POST['message']; ?>

</BODY>
</HTML>

make sure to insert form tag for your code.

First things first, do yourself a favor and get a html & php editor preferably with syntax checking (some are free, google for notepad++) it saves alot of time...
Ok
In your html file:

1. Make sure you close your html tags (/>)
2. Is

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

not

<input type = "text" Name="sender_name" size = 30>

.
3. Double check how you name your input tags: "sender_email" is not the same as "sender_mail" (as you do in send_simpleform.php) and im sure that's why nothiing is displayed.

So try this for your html file:

<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>Email - ID: </strong><br>
<input type = "text" name="sender_mail" 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>

Now for the send_simpleform.php file :

1. It Is

$_POST

not

$_post

.
2. It Is

_$POST['sender_name']

not

$_POST[sender_name]

3. It is

echo $_POST['sender_mail'];

not

echo "$_POST[sender_email]"

.

So your file must be something like:

<?
  if(($_POST['sender_name'] == "") ||
     ($_POST['sender_mail']== "") ||
     ($_POST['message'] == ""))
   {
      //header("Location: simple_form.html");
      exit;
    }
$msg = "EMail sent from WWW site \n";
$msg .= "senders Name:\t" . $_POST['sender_name'] . "\n";
$msg .= "Senders E-Mail:\t" . $_POST['sender_email']. "\n";
$msg .= "Message:\t" . $_POST['message'] . "\n";
$to = "you@youremail.com";
$subject = "Web Site Feedback";
$mailheaders = "From: My Web Site <genericaddress@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>
<? echo $_POST['sender_name']; ?>
<P><strong>Your E-Mail Address:</strong><br>
<? echo $_POST['sender_email']; ?>

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

</BODY>
</HTML>

Try that, I think it will run with no problems.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.