Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-09-2012, 01:49 PM   PM User | #1
calsta
New Coder

 
Join Date: Apr 2012
Posts: 67
Thanks: 12
Thanked 1 Time in 1 Post
calsta is an unknown quantity at this point
i need help

i have written a php code which submits a form to my email address for some reason instead of sending the data that has been inputted it sends:
<br><hr><br>
Email: <br>
Account number: <br>
Company: <br>
Order: <br>
i am wondering if you can help me fix this thanks
here is the whole code:
Code:
<?php

/* SUBJECT AND EMAIL*/

	$emailSubject = 'Order';
	$webMaster = 'cal.bramley@googlemail.com';
	
/* Gathering Data Variables */
	$company = $_POST['company'];
	$order = $_POST['order'];
	$email = $_POST['Email'];
	$accountnumber = $_POST['account number'];
	
	
	$body = <<<EOD
<br><hr><br>
Email: $email <br>
Account number: $accountnumber <br>
Company: $company <br>
Order: $order <br>
EOD;

	$headers = "From: $email\r\n";
	$headers .= "Conetent-type: text/html\r\n";
	$success = mail($webMaster, $emailSubject, $body, $headers);
	

?>
calsta is offline   Reply With Quote
Old 04-09-2012, 01:56 PM   PM User | #2
php_rockzz
New Coder

 
Join Date: Apr 2012
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
php_rockzz is an unknown quantity at this point
can i have a look at the form from where you are taking the values like
PHP Code:
$company $_POST['company'];
    
$order $_POST['order'];
    
$email $_POST['Email'];
    
$accountnumber $_POST['account number']; 
php_rockzz is offline   Reply With Quote
Old 04-09-2012, 01:58 PM   PM User | #3
calsta
New Coder

 
Join Date: Apr 2012
Posts: 67
Thanks: 12
Thanked 1 Time in 1 Post
calsta is an unknown quantity at this point
Quote:
Originally Posted by php_rockzz View Post
can i have a look at the form from where you are taking the values like
PHP Code:
$company $_POST['company'];
    
$order $_POST['order'];
    
$email $_POST['Email'];
    
$accountnumber $_POST['account number']; 
the code for the form is below:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#Layer1 {
	position:absolute;
	width:112px;
	height:73px;
	z-index:1;
	left: 49px;
	top: 14px;
}
body {
	background-color: #000000;
}
#Layer2 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:2;
	left: 211px;
	top: 115px;
}
#Layer3 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:3;
	left: 7px;
	top: 114px;
}
.style1 {color: #FFFFFF}
-->
</style>
</head>

<body>
<div id="Layer2">
<form action="process.php" method="post">
  <p>
    <input name="Email" type="text" id="Email" />
</p>
  <p>
    <input name="account number" type="text" id="account number" />
  </p>
  <p>
      <input type="text" name="company" />
    Company: 
    <br />
    <textarea name="order" cols="50" rows="8"></textarea>
  </p>
  <label for="Submit"></label>
  <input type="submit" name="Submit" value="Submit" id="Submit" />
  Or

der: 
</form>
</div>
<div id="Layer1"><img src="http://images.thomann.de/pics/herstlogos/gewa.gif" width="154" height="89" alt="Logo" /></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div id="Layer3">
  <div align="right">
    <p class="style1">Email of user: </p>
    <p class="style1">Account Number: </p>
    <p class="style1"> Company:</p>
    <p class="style1">Order:</p>
  </div>
</div>
<p>&nbsp;</p>
</body>
</html>
calsta is offline   Reply With Quote
Old 04-09-2012, 03:01 PM   PM User | #4
php_rockzz
New Coder

 
Join Date: Apr 2012
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
php_rockzz is an unknown quantity at this point
Ur code is working fine over here except that its not getting the value of the account number..

The reason is because it has a space between account and number..
replace and use as:
Code:
<input name="account_number" type="text" id="account_number" />
PHP Code:
$accountnumber $_POST['account_number']; 
When i echo the $body, im getting the input values as the output..
php_rockzz is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:34 AM.


Advertisement
Log in to turn off these ads.