First time to build a website and need a little help with my script. I am getting the emal from the sender, the subject and the description but all other Requests are lost somewhere. Please help :/

<?php
$to = "user@example.com"; 
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$cname = $_REQUEST['cname'] ;
$curl = $_REQUEST['curl'] ;
$getus = $_REQUEST['getus'] ;
$phone = $_REQUEST['phone'] ;
$description = $_REQUEST['description'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $description, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>

You haven't posted enough info. Post a copy of the form that is passing along the info in question.

<FORM ACTION="thankyou.php" method="post" name="myform">
								<table width="80%" align="left" cellpadding="0" cellspacing="0" style="border:0px solid #000;" >
                                  <tr >								  
                                  <td style="padding:5px 0px; height:15px; width:90px">Your Name &nbsp;*</td>
                                   <td  style="width:150px" onfocus="MM_validateForm('name','','R','email','','RisEmail','phone','','NisNum','description','','R');return document.MM_returnValue">
                                    <input name="name" type="text" id="name" style="border:1px solid #ccc; background-color:#FFF" size="33" /></td>
                                  </tr>
                                  <tr >
								  <td style="padding:5px 0px; height:15px;">Email &nbsp;<span style="padding:5px 0px; height:15px; width:90px">*</span></td>
                                  <td>
                                        <input name="email" type="text" id="email" style="border:1px solid #ccc; background-color:#FFF" size="33" />                                    </td>
                                  </tr>								  
								  <tr >
								  <td style="padding:5px 0px; height:15px;">Company Name&nbsp;</td>
                                    <td>
                                        <input name="cname" type="text" id="cname" style="border:1px solid #ccc; background-color:#FFF" size="33" />                                    </td>
                                  </tr>
								  <tr >
								  <td style="padding:5px 0px; height:15px;">Company Url&nbsp;</td>
                                    <td>
                                        <input name="curl" type="text" id="curl" size="33" style="border:1px solid #ccc; background-color:#FFF" />                                    </td>
                                  </tr>
								  <tr >
								  <td style="padding:5px 0px; height:15px;">How did you find us ?&nbsp;</td>
                                    <td><select name="getus" id="getus" style="border:1px solid #ccc; background-color:#FFF; width:224px" >
                                      <option value="">---------------Please Select---------------</option>
                                      <option value="Paper Advertisement">Paper Advertisement</option>
                                      <option value="Company Website">Company's Website</option>
                                      <option value="Search Engine">Search Engine</option>
                                      <option value="Friend Reference">Friend's Reference</option>
                                      <option value="Others">Others</option>
                                    </select>                                    </td>
                                  </tr>
								      <tr >
								  <td style="padding:5px 0px; height:15px;">Telephone&nbsp;</td>
                                    <td>
                                        <input name="phone"  id="phone" type="text" size="33" style="border:1px solid #ccc; background-color:#FFF" />                                    </td>
                                  </tr>
                            	  <td style="padding:5px 0px; height:15px; text-align:left">Description &nbsp;*</td>
                                    <td><textarea name="description" cols="25" rows="4" wrap="physical" id="description" ></textarea></td>
                                  </tr>
                                  <td colspan="3" style="padding-right:130px; text-align:right"><input name="submit" type="submit" style="background-image:url(images/button.gif); background-repeat:no-repeat; background-color:transparent; width:79px; height:27px; font-size:11px; font-weight:bold; color:#fff; border:0px" value="Submit" />
                                      &nbsp;
                                    <input name="reset" type="reset" value="Reset" class="bodytext" style="background-image:url(images/button.gif); background-repeat:no-repeat; background-color:transparent; width:79px; height:27px; font-size:11px; font-weight:bold; color:#fff; border:0px"/>&nbsp;</td>
                                  </tr>
                                  <tr>
                                    <td colspan="3" style="padding-left:125px">&nbsp;</td>
                                  </tr>
                                </table>
				  </form>

Okay, I see a few things here. Although REQUEST will work, if you are using a form method of POST I would suggest using POST on your thankyou.php as well.
ie.

$name = $_POST['name'] ;

I'm not quite sure what you are looking to do here with "reset" but you are not submitting the form.

<input name="reset" type="reset" value="Reset" class="bodytext" style="background-image:url(images/button.gif); background-repeat:no-repeat; background-color:transparent; width:79px; height:27px; font-size:11px; font-weight:bold; color:#fff; border:0px"/>

Changing type="reset" to type="submit" will submit the form. If "reset" is meant to do something else you will need to add a submit button.

<input type="submit" name="some_name" value="Submit Info" />

Sorry about the last post ... I totally overlooked that you do have a submit button. It's been a long day 8-). I see what you are doing now with reseting the form. Let me have another look here.

When you say the other info is getting lost somewhere, have you tried to echo one of the variables to see if it is actually holding a value?

echo $phone;  die;

Okay, I see a few things here. Although REQUEST will work, if you are using a form method of POST I would suggest using POST on your thankyou.php as well.
ie.

$name = $_POST['name'] ;

I'm not quite sure what you are looking to do here with "reset" but you are not submitting the form.

<input name="reset" type="reset" value="Reset" class="bodytext" style="background-image:url(images/button.gif); background-repeat:no-repeat; background-color:transparent; width:79px; height:27px; font-size:11px; font-weight:bold; color:#fff; border:0px"/>

Changing type="reset" to type="submit" will submit the form. If "reset" is meant to do something else you will need to add a submit button.

<input type="submit" name="some_name" value="Submit Info" />

Thank you for helping me out. The "submit" button starts at line 42. I changed the REQUEST to POST and tried sending the information again and it still is not all coming through. The reset button is to reset the form fields. Can you tell me if I got the php script correct on line 12?

Thank you for helping me out. The "submit" button starts at line 42. I changed the REQUEST to POST and tried sending the information again and it still is not all coming through. The reset button is to reset the form fields.

Yeah, sorry about that ... I realized that after the fact. For some reason I was confusing the request with reset. Like I said, it's been a long day. The forms looks good and I can't really see where the info would get "lost." I take it then that you are not getting a result when echoing one of the variables after you submit the form?

Yeah, sorry about that ... I realized that after the fact. For some reason I was confusing the request with reset. Like I said, it's been a long day. The forms looks good and I can't really see where the info would get "lost." I take it then that you are not getting a result when echoing one of the variables after you submit the form?

That is correct. I am not getting "name", "cname", "curl", "getus" or "phone".

This is a real stretch but just to rule it out you can try adding an enctype to your form tag. It's not absolutely required with the exception of file uploads.

<FORM ACTION="thankyou.php" method="post" name="myform" enctype="multipart/form-data">

This is a real stretch but just to rule it out you can try adding an enctype to your form tag. It's not absolutely required with the exception of file uploads.

<FORM ACTION="thankyou.php" method="post" name="myform" enctype="multipart/form-data">

Didn't work. Frustrating script stuff!

I'm not quite sure what the problem is. I replicated your form and everything I echoed returned a value for that form field. I had to remove the class and style attributes from the submit and reset inputs but I doubt that made a difference. Everything submitted and echoed okay for me.

I'm not quite sure what the problem is. I replicated your form and everything I echoed returned a value for that form field. I had to remove the class and style attributes from the submit and reset inputs but I doubt that made a difference. Everything submitted and echoed okay for me.

Ok thanks! I really appreciate your time.

Just out of curiosity try stripping down your submit tag and see what happens.

<input type="submit" name="submit" value="submit" />

Just out of curiosity try stripping down your submit tag and see what happens.

<input type="submit" name="submit" value="submit" />

Didn't work.

Boy am I running out of ideas here. This is going to sound stupid so don't take offense but are you echoing the variables from within the php opening and closing tags?

<?php
$to = "user@example.com"; 
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$cname = $_REQUEST['cname'] ;
$curl = $_REQUEST['curl'] ;
$getus = $_REQUEST['getus'] ;
$phone = $_REQUEST['phone'] ;
$description = $_REQUEST['description'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $description, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }

echo ''.$name.'<br />'. $cname.' <br />'.$getus.'<br />'.$email.'<br />'.$phone.'<br />'.$description.''; 
?>

Boy am I running out of ideas here. This is going to sound stupid so don't take offense but are you echoing the variables from within the php opening and closing tags?

<?php
$to = "user@example.com"; 
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$cname = $_REQUEST['cname'] ;
$curl = $_REQUEST['curl'] ;
$getus = $_REQUEST['getus'] ;
$phone = $_REQUEST['phone'] ;
$description = $_REQUEST['description'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $description, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }

echo ''.$name.'<br />'. $cname.' <br />'.$getus.'<br />'.$email.'<br />'.$phone.'<br />'.$description.''; 
?>

You don't sound stupid, I am brand new to this. No I did not echo, am I supposed to?

If you want to know for sure that info you are passing from the form to the thankyou.php is actually going through you would echo the variable like the example I have above and see if it returns the value of the form field being passed.

I think that what is happening here is that your info is not getting lost ... you are just not using it for anything. On your thankyou.php page you are only using the variables to, $subject, $description, $headers . The rest of the info is there, it's just not being used for anything.

Try this:

<?php
$to = "user@example.com"; 
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$cname = $_REQUEST['cname'] ;
$curl = $_REQUEST['curl'] ;
$getus = $_REQUEST['getus'] ;
$phone = $_REQUEST['phone'] ;
$description = $_REQUEST['description'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $description, $headers) ;
if($sent)
{print "Thank you $name, your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }

You're info is not getting lost, you are just not using it for anything.
Adding $name to the following code

{print "Thank you $name, your mail was sent successfully"; }

Allows you to use the name the was passed with the form submission.

If you want to know for sure that info you are passing from the form to the thankyou.php is actually going through you would echo the variable like the example I have above and see if it returns the value of the form field being passed.

I think that what is happening here is that your info is not getting lost ... you are just not using it for anything. On your thankyou.php page you are only using the variables to, $subject, $description, $headers . The rest of the info is there, it's just not being used for anything.

Try this:

<?php
$to = "user@example.com"; 
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$cname = $_REQUEST['cname'] ;
$curl = $_REQUEST['curl'] ;
$getus = $_REQUEST['getus'] ;
$phone = $_REQUEST['phone'] ;
$description = $_REQUEST['description'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $description, $headers) ;
if($sent)
{print "Thank you $name, your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }

You're info is not getting lost, you are just not using it for anything.
Adding $name to the following code

{print "Thank you $name, your mail was sent successfully"; }

Allows you to use the name the was passed with the form submission.

I tried this and still is not working.....

<?php
$to = "randall.schultz@caddforce.com"; 
$subject = "Contact Us";
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$cname = $_POST['cname'] ;
$curl = $_POST['curl'] ;
$getus = $_POST['getus'] ;
$phone = $_POST['phone'] ;
$description = $_POST['description'] ;
$headers = "From: $email" ;
$sent = mail($to, $subject, $description, $headers) ;
if($sent)
{print "Thank you $name, your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>

Okay, let's start here. What exactly is not working for you? Is it not sending the mail ?? I can see the problem there straight off.
// Edit - I see you changed your $to variable since the last post.

Okay, let's start here. What exactly is not working for you? Is it not sending the mail ?? I can see the problem there straight off.
// Edit - I see you changed your $to variable since the last post.

I changed the to variable in the code so everybody wouldn't have my email address but forgot to take it out when I just put the php script in there.

I am getting an email that comes from the address plugged into the form and I am getting the subject in the subject line and the description in the body of the email.

What I am not getting is cname, curl, getus and phone.

Got ya' with the email thing. Understood. When you say you are not getting that info, you are not getting it in the email ??

Got ya' with the email thing. Understood. When you say you are not getting that info, you are not getting it in the email ??

Right, not getting it in the email.

Ah, now it makes a little sense !! Well in that case let me help ya' out with that one 8-)

Try this:

<?PHP
$to = "user@example.com"; 
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$cname = $_REQUEST['cname'] ;
$curl = $_REQUEST['curl'] ;
$getus = $_REQUEST['getus'] ;
$phone = $_REQUEST['phone'] ;
$description = $_REQUEST['description'] ;
$headers = "From: $email";

$msg = '
'.$email.'
'.$name.'
'.$cname.'
'.$curl.'
'.$getus.'
'.$phone.'

'.$description.' ';

$sent = mail($to, $subject, $msg, $headers) ;
if($sent)
{print "$name, Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }

Ah, now it makes a little sense !! Well in that case let me help ya' out with that one 8-)

Try this:

<?PHP
$to = "user@example.com"; 
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$cname = $_REQUEST['cname'] ;
$curl = $_REQUEST['curl'] ;
$getus = $_REQUEST['getus'] ;
$phone = $_REQUEST['phone'] ;
$description = $_REQUEST['description'] ;
$headers = "From: $email";

$msg = '
'.$email.'
'.$name.'
'.$cname.'
'.$curl.'
'.$getus.'
'.$phone.'

'.$description.' ';

$sent = mail($to, $subject, $msg, $headers) ;
if($sent)
{print "$name, Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }

Wow! You are the man! I got all the information back. I owe you one!
Here is a link to the page you just fixed :)
http://caddforce.com/business-inquiry.html
Randall

You are not getting the info beacuse you never sent it.
The $description variable should carry all of the text that you want to read.

<?php
$to = "user@example.com"; 
$subject = "Contact Us";
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$cname = $_REQUEST['cname'] ; // none of these go anywhere
$curl = $_REQUEST['curl'] ;
$getus = $_REQUEST['getus'] ;
$phone = $_REQUEST['phone'] ;
$description = $_REQUEST['description'] ;//this got sent
$headers = "From: $email";
$sent = mail($to, $subject, $description, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>

You will need to format a plain text or html style page to be read on a browser .
None of those variables were included in the $description string so you
won't see them.

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.