473,568 Members | 2,962 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web page form is not sending email

3 New Member
Hi,

I have been encountering problems with my web page which is supposed to send email, and wondered if anybody can help find error.

Initially I had all codes in one page and on click of Submit it would send email.
But then I wanted to give a user an opportunity to go back and edit the entries if incorrect before submitting. I separted the codes into two pages.
On the second page when Submit button is clicked it should send email. But it is not working.
My code in the second page is following. Can anybody help please:

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2. <!--
  3. .style1 {color: #FF0000}
  4. -->
  5. </style>
  6. <? 
  7.  if (!isset($Submit)) 
  8.  ?>
  9. <table width=570 border=0 align=center cellpadding="0" cellspacing="0" bordercolor="#eaeaea"> 
  10.   <form action="?do=river-ride_pay" method="post" enctype="multipart/form-data" name="form1" id="form1" /> <tr> 
  11.     <td bgcolor="#eaeaea" width="5"></td> 
  12.     <td bgcolor="#eaeaea"><p><b>YOUR PROFILE </b></p></td> 
  13.     <td bgcolor="#eaeaea" width="5"></td> 
  14.   </tr> 
  15.   <tr>  
  16.   <tr> 
  17.     <td width="5" background="http://crca.caloosahatchee.org/img/tablebgrwr.jpg"></td> 
  18.     <td> <p><b>You have entered the following information </b>(The information has been sent to your email address as well for your records)<strong>:</strong><br> 
  19.         <br> 
  20.         <?php echo "
  21.  
  22.                         <b>Name:</b> ".stripslashes($first)." ".stripslashes($last)."<br>
  23.                         <b>E-mail:</b> <a href=\"mailto:$email\">$email</a><br>
  24.                         <b>Phone (day):</b> $home_phone<br>
  25.                         <b>Phone (evening):</b> $mobile\n<br>
  26.                         <b>Address:</b> $address, $city, $state $zip<br>
  27.                         <b>City:</b> $city <br>
  28.                         <b>State:</b> $state <br>
  29.                         <b>Zip:</b> $zip <br>
  30.                         <b>Fax:</b> $fax <br>
  31.                         <b>Emergency Contact Name: </b> $emerg_contact<br>
  32.                         <b>Emergency Phone Number: </b> $emerg_phone<br>
  33.                         <b>Shirt Size: </b> $shirt<br>
  34.                         <b>Amount:</b> $amount_d<br>
  35.                         <b>Miles: </b> $miles<br>
  36.                         <b>CRCA Membership: </b> $crca_mem<br> "; ?> 
  37.       <p>Please check if the information you have provided is correct, if not <a href='?do=river-ride&first=<?php echo"$first"; ?>&last=<?php echo"$last"; ?>&email=<?php echo"$email"; ?>&home_phone=<?php echo"$home_phone"; ?>&mobile=<?php echo"$mobile"; ?>&address=<?php echo"$address"; ?>&city=<?php echo"$city"; ?>&state=<?php echo"$state"; ?>&fax=<?php echo"$fax"; ?>&zip=<?php echo"$zip"; ?>&state=<?php echo"$state"; ?>&emerg_contact=<?php echo"$emerg_contact"; ?>&emerg_phone=<?php echo"$emerg_phone"; ?>&shirt=<?php echo"$shirt"; ?>&amount=<?php echo"$amount"; ?>&miles=<?php echo"$miles"; ?>&crca_mem=<?php echo"$crca_mem"; ?>'>Go Back and Correct</a>!</p> 
  38.       <p align='center'> 
  39.         <input type="submit" name="Submit" value="Submit" class="normal" /> 
  40.         </form> </td> 
  41.     <td width="5" background="http://crca.caloosahatchee.org/img/tablebgrwl.jpg"></td> 
  42.   </tr> 
  43.   <tr> 
  44.     <td><img src="http://crca.caloosahatchee.org/img/tablebgl.jpg"></td> 
  45.     <td background="http://crca.caloosahatchee.org/img/tablebgrb.jpg"></td> 
  46.     <td><img src="http://crca.caloosahatchee.org/img/tablebgr.jpg"></td> 
  47.   </tr> 
  48. </table> 
  49. <?php
  50.  
  51.  
  52.             $date=date("Y-m-d");
  53.             $id=date("Y-m-d H:i:s");
  54.  
  55.             $id_array=explode(" ", $id);  
  56.             $id1=explode("-", $id_array[0]);
  57.             $id2=explode(":", $id_array[1]);
  58.             $id=$id1[0].$id1[1].$id1[2].$id2[0].$id2[1].$id2[2];
  59.  
  60.     $reg1="insert into donors values ('$id','$date','$last','$first','$email','$address','$city','$state','$zip','$home_phone','$mobile','$fax','emerg_contact','emerg_phone','shirt','miles','crca_mem','$amount_d')"; 
  61.  
  62.         $query1=mysql_query($reg1);
  63.  
  64.         if (!$query1) 
  65.         {
  66.             echo "Can't register in donors";
  67.             include("http://crca.caloosahatchee.org/includes/close.php");
  68.             exit;
  69.         }
  70.  
  71.  
  72.         // sending confirmation messages
  73.             if ($email<>NULL) 
  74.             {
  75.                 $header = "Content-Type: text/html; charset=iso-8859-1\r\n";
  76.  
  77.                 $message = "Dear $first $last, \n\n";
  78.                 $message .= "Thank you for your great interest in participating in our 13th Annual Caloosahatchee River Ride Event! \n\n";
  79.                 $message .= "Following is your profile information you submitted to us:\n\n";
  80.                 $message .= "Email: $email\n";
  81.                 $message .= "Phone (day): $home_phone\n";
  82.                 $message .= "Phone (evening): $mobile\n";
  83.                 $message .= "Address: $address\n";
  84.                 $message .= "City: $city\n";
  85.                 $message .= "State: $state\n";
  86.                 $message .= "Zip Code: $zip\n";
  87.                 $message .= "Fax: $fax\n";
  88.                 $message .= "Emergency Contact Name: $emerg_contact\n";
  89.                 $message .= "Emergency Phone Number: $emerg_phone\n";
  90.                 $message .= "Shirt Size: $shirt\n";
  91.                 $message .= "Amount: $amount_d\n";
  92.                 $message .= "Miles: $miles\n";
  93.                 $message .= "CRCA Membership: $crca_mem\n\n";
  94.  
  95.                 $message .= "If you have not yet paid your registration fee of $25.00, please do so now at https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8215269     \n\n";
  96.                 $message .= "As soon as we receive your payment we will confirm your registration to be complete. Thank you!\n\n";
  97.  
  98.                 $message .= "Sincerely,\n";
  99.                 $message .= "CRCA Administration \n\n";
  100.                 //$message .= "P. S.<br>";
  101.                 //$message .= "Your payment amount: $ $amount_d<br>";
  102.                 //$message .= "Date:".date("Y-m-d")."<br>";
  103.  
  104.                 $from = "From: riverride09@caloosahatchee.org\n";
  105.                 $reply = "Reply-To: riverride09@caloosahatchee.org";
  106.  
  107.                 $header .= $from . $reply;
  108.  
  109.                 $sentmail = mail($email, "River Ride Registration Confirmation", $message, $header);
  110.             }
  111.  
  112.             if ($sentmail) 
  113.             {
  114.                 //$message = "*** THIS IS A POSSIBLE PAYMENT CONFIRMATION FOR RIVER RIDE EVENT *** \n\n";
  115.                 $message = "River Ride Registration Confirmation message sent by $first $last on ".date("Y-m-d")."\n\n";
  116.                 $message .= "Other Details are:\n";
  117.                 $message .= "Email: $email\n";
  118.                 $message .= "Phone (day): $home_phone\n";
  119.                 $message .= "Phone (evening): $mobile\n";
  120.                 $message .= "Address: $address\n";
  121.                 $message .= "City: $city\n";
  122.                 $message .= "State: $state\n";
  123.                 $message .= "Zip Code: $zip\n";
  124.                 $message .= "Fax: $fax\n";
  125.                 $message .= "Emergency Contact Name: $emerg_contact\n";
  126.                 $message .= "Emergency Phone Number: $emerg_phone\n";
  127.                 $message .= "Shirt Size: $shirt\n";
  128.                 $message .= "Amount: $amount_d\n";
  129.                 $message .= "Miles: $miles\n";
  130.                 $message .= "CRCA Membership: $crca_mem\n\n";
  131.                 $message .= "Sincerely,\n";
  132.                 $message .= "CRCA Administration\n";
  133.                 $from = "From: riverride09@caloosahatchee.org\n";
  134.                 $reply = "Reply-To: riverride09@caloosahatchee.org";
  135.                 $header = $from . $reply;
  136.                 $email2 = "riverride09@caloosahatchee.org";
  137.                 mail($email2, "River Ride Registration Confirmation", $message, $header);
  138.             }
  139.     ?>
Sep 21 '09 #1
8 2901
Markus
6,050 Recognized Expert Expert
What part isn't working exactly? Do you get any errors?
Sep 21 '09 #2
TheServant
1,168 Recognized Expert Top Contributor
When something like this doesn't work, try do something simple. Try send a simple email and then add each component so you can narrow it down to whether it's the message, to, email, or from component that it stopping it from working.
Sep 21 '09 #3
prabirchoudhury
162 New Member
hey

i think you are having problem with first argument with if ($email<>NULL) argument. it is returning false all the time coz it is not a valid argument for checking "NULL" value in php.

you could try with those bellow
Expand|Select|Wrap|Line Numbers
  1. if (isset($email){
  2.  
  3.      }
  4. if (!empty($email){
  5.  
  6.      }
  7. if (!is_null($email){
  8.  
  9.      }
  10.  
  11.  
you dont have any problem with mail() function.

have a look on this


cheers

:)
Sep 21 '09 #4
Dormilich
8,658 Recognized Expert Moderator Expert
two further ways to test for null:
Expand|Select|Wrap|Line Numbers
  1. if ($email != NULL) // also triggered by 0, false, ""
  2.  
  3. if ($email !== NULL) // must match the type also
Sep 22 '09 #5
nargis2009
3 New Member
@Markus
I am a beginner, and it is hard for me to find the error in codes once the codes get complicated. In fact is not showing any error when I browse the pages. It is just not sending email.

When I first had all the codes is one page, I had no problem, it would send email just fine. But when i am trying to separate codes into two or three pages it is not working any more.
My only purpose of separating pages is not let the information emailed right away after submission as it would do when I had just one page.

Nargis
Sep 22 '09 #6
prabirchoudhury
162 New Member
you are right, you have an logical problem thats why it is not showing any error. coz how is ur argument working if the first if ($email<>NULL) is false then it would not assign "$sentmail" variable and then if ($sentmail) is false so no mail is being sent . both cases it is not going inside the if statement.

here you go

1. you are getting all the personal details along with $email from some form submit or other place
2. then why you are checking $mail <> NULL then ISSET() or empty()
3. I don’t think you are getting all this details from database then you could check <> NULL value
4. but you are inserting those details into table first and then.

my understanding is

a. validate the email address first that is assign to $email
b. check $email if (isset($email)) {} or if (!empty($email) ){}

then you should be alright

cheers
:)
Sep 22 '09 #7
nargis2009
3 New Member
Hi, Prabir,
Thank you all for your help. I tried all your suggestions, but I seem not succeeding.

I think I have complicated everything by trying to split the codes into 3 pages.
My objective was:
Page1- to fill out the form - submit
Page2- if the infomation is incorrect - go back and correct - but if correct click on the 'submit' to send email
Page3 - make payment

I have attached the codes of the 3 pages, so as to make it more clear.
If anybody has time, I would greatly appreciate your response.

Thank you.
Nargis
Attached Files
File Type: txt page1.txt (2.8 KB, 414 views)
File Type: txt page2.txt (2.6 KB, 395 views)
File Type: txt page3.txt (5.5 KB, 444 views)
Sep 23 '09 #8
TheServant
1,168 Recognized Expert Top Contributor
OK. It looks like you are sending your email from page one, so it's really page 1 that is not working. Before I go much further, can you confirm that besides the email not sending it is going onto the next page and all else is good?

If so, try and replace your email line with an echo and see if it fires. If so, it's your mail function and if not, obviously it's surrounding code.

Just focus on one page at a time, and first page is a good start.
Sep 23 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4015
by: Kingdom | last post by:
I have a SelectBoxes.asp page that is working with multiple selection dropdown boxes to extract data and total the selection prices. Tom & Bob were kind enough to give me a big help getting this page working and it's working just fine, no problems with this page. However I then would like this data e-mailed using jmail (my host insists on...
4
2329
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I need to: 1. Click a submit button on an asp page, calling another page that saves the contents of that form to a database and then displays
2
1902
by: Joe | last post by:
Hi, I am sending an email from an asp page. Besides sending an email to sender, I am sending myself a BCC also. Out of 100 emails sent, about 5 recipients received a blank email (no text in subject and body). The BCC of all these emails that I sent to myself were fine. When I send email manually to these 5 recipients they receive it...
4
1599
by: Raul M. Colon | last post by:
I have a web application and need to redirect to a another page. Is there any way to see the redirected page in a new page? (that's keeping the sending page visible) Thanks!!! Raul
6
4854
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still...
2
3336
by: lmlaster | last post by:
I have 2 webs under my default web running win2003 1. A front-page intranet 2. A asp (not .net) web is fine Both allow anonomous access. My front page web always gets a BLANK Request.ServerVariables("Logon_User"). The asp web gets the logon_user OK. Both webs have a global.asa that has Sub Session_Onstart() session("logon") = ...
5
4802
by: Tim | last post by:
I got one form working properly. Then I tried to introduce a second. For a while, sending information through either form went through just the second. Then I rearranged some script, and now nothing gets sent at all. (There's also an email link between the two forms.) What should be the correct order? Here's the basic code. <div...
3
1474
by: chaitanya02 | last post by:
Hi All,, I used this code to send an email to anyone, from my asp page, which accepts email address from the users of the form: Sending a text e-mail using a remote server: <% Set myMail=CreateObject("CDO.Message") myMail.Subject="Sending email with CDO" myMail.From="mymail@mydomain.com"
7
3322
by: bleachie | last post by:
Hey, I just need some help, my form seems to not send me all of the 'guestNames' and 'guestEmails' forms. i use this function to add more guestnames and guestemail fields based on the number of guests added. form.php function createGuestNameAndEmailElements() {
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.