Page 1 of 1

Error in getting the values from the form

Posted: Thu Sep 27, 2007 5:50 am
by kamit_sr
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


this is my html form
[syntax="html"]<body>
	<table cellpadding="0" cellspacing="0">
	<tr>
		<td>
		<form name="contact" action="http://www.net-repositor.com/phpscript/contact.php" method="post">
	<table cellpadding="0" cellspacing="0">
		<tr><td colspan="2" class="tdhead">Contact Us</td></tr>
		<tr><td width="117"  class="tdcontentform">Last Name ::</td><td><input type="text" name="lastName" size="15" ></td></tr>
		<tr><td class="tdcontentform">First Name ::</td><td ><input type="text" name="firstName" size="15" ></td></tr>
		<tr><td class="tdcontentform">Company  ::</td><td ><input type="text" name="company" size="15" ></td></tr>
		<tr><td class="tdcontentform">Email Id ::</td><td ><input type="text" name="email" size="15" ></td></tr>
		<tr><td class="tdcontentform">Contact No. ::</td><td ><input type="text" name="contactNo" size="15" ></td></tr>
		<tr><td height="29" class="tdcontentform">Project Type ::</td>
		<td><input type="text" name="projectType" size="15" ></td></tr>
		<tr><td class="tdcontentform">Project Budget ::</td><td ><input type="text" name="budget" size="15" ></td></tr>
		<tr><td class="tdcontent3">Little Description ::</td><td align="center"><textarea  name="prDescription" rows="9" cols="30" wrap="off" ></textarea></td></tr>
		<tr><td></td><td ><input  type="submit"  value="Submit"  size="15" ></td></tr>
		
	</table>
	</form>
/////////////////////////////////////////////

this is my script[/syntax]

Code: Select all

<?php
	
		$to = "kamit.sr@gmail.com";
		$subject=$_REQUEST["projectType"].date('d-m-y h:i:s');
		$body=$_REQUEST["lastName"] +$_REQUEST["firstName"]+$_REQUEST["company"]+$_REQUEST["email"]+$_REQUEST["contactNo"]+$_REQUEST["projectType"]+$_REQUEST["budget"]+$_REQUEST["prDescription"];
		
		$response = mail($to,$subject,$body);
		if($response==false)
		{
			echo 'failed';
		}else{
				echo 'success';
				
	}
?>
////////////////////////////////

I AM NOT ABLE TO GET ALL THE VALUES FROM THE FORM JUST CONTACT NO DONT KNOW WHY
CAN ANYONE HELP....

THANKS IN ADVANCE


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Sep 27, 2007 6:18 am
by Hemlata
Hello,

After form get posted, you will be getting form variables in either $_POST or in $_GET variable. Try to print $_POST variable once the form is submitted. You sholld get the required results.

Regards,

Posted: Thu Sep 27, 2007 6:30 am
by paulbm

Code: Select all

$body="lastname : ".$_POST["lastName"] ."\n".
"firstname : ".$_POST["firstName"]."\n".
"company : ".$_POST["company"]."\n".
"email : ".$_POST["email"]."\n".
"contact number : ".$_POST["contactNo"]."\n".
"project type : ".$_POST["projectType"]."\n".
"budget : ".$_POST["budget"]."\n".
"description : ".$_POST["prDescription"];
That should make the $body variable more readable when it's sent in the email.

Thanks

Posted: Sat Oct 06, 2007 8:54 am
by kamit_sr
Thanks,

all of you for your valuable suggestions,

it really helped