Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-06-2008, 08:39 PM
calvynlee's Avatar
Blogging Moderator
 
Join Date: Jul 2006
Location: LittlePenang.com
Posts: 1,576
Rep Power: 59
calvynlee has a spectacular aura about calvynlee has a spectacular aura about
mail function debug help

dear coder,

Recently i search over the net and obtain some mail function code, and trying to add in addition information

I have create a form (order.htm)and trying to call the (order.php) php code as below
PHP Code:
<?php $ip $_POST['ip']; 
$httpref $_POST['httpref']; 
$httpagent $_POST['httpagent']; 
$client $_POST['client']; 
$clientmail $_POST['clientmail'];
$clientdomain $_POST['clientdomain'];
$clientaddress $_POST['clientaddress'];
$clientphone $_POST['clientphone'];
$clientpromo $_POST['clientpromo'];
$clientpackage $_POST['clientpackage'];
$clientpayment $_POST['clientpayment'];
$clientcomment $_POST['clientcomment'];


if (
eregi('http:'$clientcomment)) {
die (
"Do NOT try that! ! ");
}
if(!
$clientmail == "" && (!strstr($clientmail,"@") || !strstr($clientmail,"."))) 
{
echo 
"<h2>Use Back - Enter valid e-mail</h2>\n"
$badinput "<h2>order was NOT submitted</h2>\n";
echo 
$badinput;
die (
"Use back! ! ");
}

if(empty(
$client) || empty($clientmail) || empty($clientdomain) || empty($clientaddress) || empty($clientphone) ) {
echo 
"<h2>Use Back - fill in all fields (Require)</h2>\n";
die (
"Use back! ! "); 
}

$todayis date("l, F j, Y, g:i a") ;

$attn $clientpackage 
$subject $attn

$clietcomment stripcslashes($clientcomment); 

$message " $todayis [EST] \n
Attention: $attn \n
Subject : $subject \n
Message: $clientcomment \n 
From: $Client ($clientmail)\n


Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
"
;

$from "From: $clientmail\r\n";


mail("host@privatehoster.com"$subject$message$from);

?>
display area
PHP Code:
<p align="center">
Date: <?php echo $todayis ?> 
<br>

Thank You : <?php echo $client ?> ( <?php echo $clientmail ?> ) 
<br>


Thank for purchasing : <?php echo $clientpackage ?>
<br>
 
Once we receive the payment, we will send you the login detail at <?php echo $clientmail ?> <br>
 
<?php $notesout str_replace("\r""<br/>"$clientcomment); 
echo 
$notesout?> 
<br>

<?php echo $ip ?>
When I receive the email, the information display are missing,

the problem probably come from

mail("host@privatehoster.com", $subject, $message, $from);

but i have no idea how to modify it...

can some one give me some guide?
__________________
I blog my IT Engineer LIFE at iCalvyn.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-06-2008, 11:17 AM
iamfreelancer's Avatar
Vibrate your Brain Please
 
Join Date: Sep 2005
Location: in my body lar...
Posts: 1,217
Rep Power: 62
iamfreelancer will become famous soon enough iamfreelancer will become famous soon enough
post your html form codes also so that i can do a full test run on my server...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-06-2008, 12:01 AM
calvynlee's Avatar
Blogging Moderator
 
Join Date: Jul 2006
Location: LittlePenang.com
Posts: 1,576
Rep Power: 59
calvynlee has a spectacular aura about calvynlee has a spectacular aura about
this is my form coding, appreciate your effort
Code:
<form method="post" action="order.php">

<!-- DO NOT change ANY of the php sections -->
<?php $ip = getenv("REMOTE_ADDR");
$httpref = getenv ("HTTP_REFERER");
$httpagent = getenv ("HTTP_USER_AGENT");
?>

                    <input name="ip" value="<?php echo $ip ?>" type="hidden">
                    <input name="httpref" value="<?php echo $httpref ?>" type="hidden">
                    <input name="httpagent" value="<?php echo $httpagent ?>" type="hidden">

    
                    <p>Full Name: <br>

    <input name="client" size="35" type="text"> (Require)<br>

    &nbsp;Email:<br>

    <input name="clientmail" size="35" type="text"> (Require)<br>

    Domain:<br>

    <input name="clientdomain" size="35" type="text"> (Require)<br>

    Address <br>

	<input name="clientaddress" size="35" type="text"> (Require)<br>

	&nbsp; <br>


    Phone: <br>

    <input name="clientphone" size="35" type="text"> (Require)<br>

    Promo Code: <br>

    <input name="clientpromo" size="35" type="text"> (Optional)<br>


    </p>
                    <p>Package :<br>

    &nbsp;
                    <select name="clientpackage" size="1">
                    <option value=" none ">Select your 'Private' Plan</option>
                    <option value=" Domain Registration ">'Private' Domain Registration RM35.00/year</option>
                    <option value=" Domain Transfer ">'Private' Domain Transfer RM30.00 1st year</option>
                    <option value=" Domain Renew ">'Private' Domain Renew RM35.00 /yearr</option>
                    <option value=" Private 1">'Private' Plan 1 RM99.99/yearr</option>
                    <option value=" Private 2">'Private' Plan 2 (Free Domain) RM189.99/year</option>
                    <option value=" Private 3">'Private' Plan 3 (Free Domain) RM279.99/year</option>
                    <option value=" Private 4">'Private' Plan 4 (Free Domain) RM369.99/year</option>
                    <option value=" Private 5">'Private' Plan 5 (Free Domain) RM459.99/year</option>
                    </select>
 <br>

    
    </p>
                    <p>Payment :<br>

    &nbsp;
                    <select name="clientpayment" size="1">
                    <option value=" none ">Select your 'Private' Payment Method</option>
                    <option value=" MayBank2u ">May Bank</option>
                    <option value=" Public Bank ">Public Bank</option>
                    <option value=" Paypal ">PayPal</option>
                    </select>


                </p>
                    <p> <br>

    
    &nbsp;Additional Comment: <br>

    &nbsp;<textarea name="clientcomment" rows="4" cols="34"></textarea> <br>

    &nbsp;<input value="'Private' Order" type="submit">

                </p>
                  </form>
__________________
I blog my IT Engineer LIFE at iCalvyn.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-06-2008, 02:05 AM
Senior Webmaster
 
Join Date: Jan 2007
Location: -
Posts: 261
Rep Power: 27
mylinear will become famous soon enough mylinear will become famous soon enough
Quote:
Originally Posted by calvynlee View Post

When I receive the email, the information display are missing,

the problem probably come from

mail("host@privatehoster.com", $subject, $message, $from);

but i have no idea how to modify it...

can some one give me some guide?
From the code you have provided, it should work properly.

When you receive the mail, is it only certain info such as IP address, browser type etc empty in the message body?

Or are all form fields empty in the mail? If so, is your form script saved with the .php file extension? If saved with .htm, it may not be parsing the php code and passing the POST data.

Hopefully iamfreelancer will have more helpful points.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-06-2008, 07:53 AM
Seanie's Avatar
Senior Webmaster
 
Join Date: Mar 2008
Location: pd
Posts: 224
Rep Power: 11
Seanie has a spectacular aura about Seanie has a spectacular aura about
By the power of copy-and-paste:

Code:
Wednesday, June 4, 2008, 7:47 am [EST]

Attention: Private 5

Subject : Private 5 

Message: what about this time

From: (sean@spammersdelight.com)

Additional Info : IP = 192.168.1.5

Browser Info: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9b5) 
Gecko/2008050509 Firefox/3.0b5

Referral :
What were you expecting?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-06-2008, 10:14 AM
calvynlee's Avatar
Blogging Moderator
 
Join Date: Jul 2006
Location: LittlePenang.com
Posts: 1,576
Rep Power: 59
calvynlee has a spectacular aura about calvynlee has a spectacular aura about
Quote:
Originally Posted by Seanie View Post

What were you expecting?
while i receive the email

it only show
Quote:
Monday, June 2, 2008, 1:43 pm [EST]

Attention: Private 1

Subject : Private 1

Message: Testing 2

From: (someone@someemail.com)



Additional Info : IP = <?php echo $ip ?>

Browser Info: <?php echo $httpagent ?>

Referral : <?php echo $httpref ?>
__________________
I blog my IT Engineer LIFE at iCalvyn.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-06-2008, 10:26 AM
Seanie's Avatar
Senior Webmaster
 
Join Date: Mar 2008
Location: pd
Posts: 224
Rep Power: 11
Seanie has a spectacular aura about Seanie has a spectacular aura about
See mylinear's post:

Quote:
If so, is your form script saved with the .php file extension? If saved with .htm, it may not be parsing the php code and passing the POST data.
The first time I copied and pasted your code, I put the third fragment you posted in something.html - and got the same results as you. I changed the filename to something.php, and it works the way you want it to.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-06-2008, 09:00 PM
iamfreelancer's Avatar
Vibrate your Brain Please
 
Join Date: Sep 2005
Location: in my body lar...
Posts: 1,217
Rep Power: 62
iamfreelancer will become famous soon enough iamfreelancer will become famous soon enough
Quote:
Originally Posted by calvynlee View Post
while i receive the email

it only show
i haven't test out your code yet... but from the look of the result file that you posted... it think it is exactly what Seanie said... save your html form page into a .php file....

if problem still exist... please let us know again.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 06-06-2008, 11:15 AM
calvynlee's Avatar
Blogging Moderator
 
Join Date: Jul 2006
Location: LittlePenang.com
Posts: 1,576
Rep Power: 59
calvynlee has a spectacular aura about calvynlee has a spectacular aura about
I have solve my problem,

just to add in those additional infor at

PHP Code:
$message " $todayis [EST] \n
Attention: $attn \n
Subject : $subject \n
Message: $clientcomment \n 
From: $Client ($clientmail)\n 
....
... 
I do face another problem here,

I have a webmail at mydomain.com/webmail, but I have set my MX record in to mail.live.com

every time people send me email, i will receive at mail.live.com, but I wonder why all this infor submit will not arrive my mail.live.com, instead drop into my server webmail.
__________________
I blog my IT Engineer LIFE at iCalvyn.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes 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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code or mail function problem? calvynlee Website Programming 6 11-05-2008 11:39 AM
Pls debug my CSS unclejim Website Design 0 28-08-2006 05:48 PM
E-Mail Backup, Email Defense, E-Mail Marketing! Get one for your website! starsearcher Web Hosting Offers 0 16-01-2006 12:03 PM
asp : tolong debug sat... ijoke Website Programming 1 13-04-2005 10:28 AM
asp : tolong debug sat... ijoke Website Design 1 24-03-2005 02:03 PM



All times are GMT +8. The time now is 09:24 AM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59