MAILER.PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thewebdecorator
Forum Newbie
Posts: 4
Joined: Wed Aug 10, 2005 9:16 am

MAILER.PHP

Post by thewebdecorator »

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


I cant figure out why this isnt working. Maybe a fresh set of eyes will help:

[b]form.html[/b]

Code: Select all

<form name="form1" method="post" action="mailer.php">
              <INPUT TYPE="hidden" NAME="cgiemail-mailopt" VALUE="sync">

  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
    <tr> 
      <td colspan="2"><font face="Verdana, Helvetica, Arial" size="2"><b>APPLICANT 
        BUSINESS INFORMATION</b></font></td>
    </tr>
    <tr> 
      <td width="40%"><font size="2" face="Verdana, Helvetica, Arial">Company 
        Legal Name:</font></td>
      <td width="60%"><font size="2" face="Verdana, Helvetica, Arial"> 
        <input name="Firm_Name" size="30">
        <label>
        <input type="submit" name="Submit" value="Submit">
        </label>
        </font></td>
    </tr>
  </table>
</form>

MAILER.PHP

Code: Select all

<?

  if (!isset($email)) {

    header( "Location: http://www.url.com/form.html" );

  }

  elseif (empty($email)) {

    header( "Location: http://www.url.com/mailer_error.html" );

  }

  else {

mail( "sales@url.com", "Web Inquiry from $name",

"Name: $name
Biz Name: $Firm_Name", "From: $realname <$email>");

header( "Location: http://www.url/mailer_thankyou.html" );

  }

?>
Any ideas?


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

I think you have forgotten the $_POST thingie here :)

Code: Select all

if (!isset($_POST['email'])) { 
    do 
} else {
    do
}
ect...

However you could do all this in one page if you want.

Change the following things like this

Code: Select all

if (isset ($_POST['submit'])) {
 #do processing of your form fields
 if (isset($_POST['email'])) {
 # mail whoever you want to mail or should receive that mail.
 # and display a thank you message
 } else {
 # message that there hasnt been a mail address filled in the form 
 # javascript can validate this easely without redirecting (google.com, search javascript form validation)
 }
} else { # me
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> 
# your form fields go here
</form>
}
Enjoy
Last edited by ol4pr0 on Tue Jan 24, 2006 2:17 pm, edited 1 time in total.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

also use PHP tags when posting PHP code in the forums.

good luck with your script!
Post Reply