42 users online (0 members and 42 guests)  


  Results 1 to 2 of 2

Related

  1. Need help with form going to email.    Forum: HTML Forum
    Replies: 1
  2. Extend my email form script    Forum: CGI Perl Forum
    Replies: 2
  3. email form script, need advice    Forum: PHP Forum
    Replies: 1
  4. PHP email form.    Forum: PHP Forum
    Replies: 2
  1. #1
    classifieds's Avatar
    New User

    Status
    Offline
    Join Date
    May 2005
    Posts
    3

    Question Please help with email form script

    Hi,

    Can someone please help? I want to be able when I receive an email from my site's form
    in the same time to add the visitor in my autoresponder software. I think I must have one more form (script)
    to get the data from my php form and send them to my autorespond software that is creating
    this form automaticaly:

    ================================================

    <form method=post action=http://www.mysite.com/mail/signup.php>
    <input type=hidden name=list value=1>
    Email: <input type=text name=email><br>
    full name: <input type=text name=user1><br>
    message: <input type=text name=user2><br> //that has to be able to take up to 4-5 lines of message(about 1000 characters)
    <input type=submit name=sup value="Subscribe Me!">
    </form>




    =================================================
    Below is the php email form from my cart:




    <?php

    session_start();
    include("admin/config.php");
    include( "admin/settings.inc.php");
    include( "shoppingcart.php");
    include( "header.inc.php");
    $cart = new Cart;

    include("subheader.inc.php");

    // start border
    sb("100%","$la_mod_cont_header",$colour_1,$colour_2);

    // navigation
    echo"<a href=\"store.php\" target=\"_self\">Home</a> > $la_mod_cont_header<br>";

    // if contact form has been submit
    if($submit){
    // validate senders email
    if ((!ereg("^[a-zA-Z0-9_.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $from_email))or(empty($from_email)))
    {
    Echo "<p><div align='center'><font color=#990000><b>$la_mod_cont_email_inv</b></font></p>";
    $again=1;
    }//end validate email
    // ensure names have been entered
    if (empty($from_name))
    {
    Echo "<p><div align='center'><font color=#990000><b> $la_account_form_must</b></font></p>";
    $again=1;
    }
    // if user did not enter a message
    if(empty($message))
    {
    Echo "<p><div align='center'><font color=#990000><b>$la_mod_cont_mess_inv</b></font></p>";
    $again=1;
    }
    // display link if error occurred
    if ($again==1)
    {
    echo"<p align=\"center\"><a href = \"contact_us.php?session=$session\">$la_mod_cont_corr</a></p>";

    } // end ($again==1)
    // build message
    if(empty($again)){

    $subject = "$la_mod_cont_Mfrom: $from_name";
    $messagebody .="$la_mod_cont_Msend $site_url.\r\n\r\n";
    $messagebody .="$la_mod_cont_Mwho $from_name $la_mod_cont_Mmail $from_email.\r\n\r\n\r\n";
    $message = stripslashes($message);
    $messagebody .="$message";
    // send mail
    mail($to_email, $subject_email, $messagebody, "From: $from_email");


    // confirmation message
    echo"<p align=\"center\">$la_mod_cont_succ <b>$to_email</b>!</p>";
    }
    }//end if submit

    // display tell a friend form
    if(!$submit){
    if(session_is_registered(valid_user))
    {
    $select = mysql_query ("select * from ".$prefix."store_customer where email='$valid_user'");
    $row = mysql_fetch_array($select);
    $from_name=$row["name"];
    $from_email=$row["email"];
    }
    ?>
    <p align="left"><?echo $la_mod_cont_sub_header?></p><br>
    <script language="JavaScript">
    <!--

    var ns6=document.getElementById&amp;&amp;!document.all

    function restrictinput(maxlength,e,placeholder){
    if (window.event&amp;&amp;event.srcElement.value.length>=maxlength)
    return false
    else if (e.target&amp;&amp;e.target==eval(placeholder)&amp;&amp;e.target.value.length>=maxlength){
    var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
    if (pressedkey.test(String.fromCharCode(e.which)))
    e.stopPropagation()
    }
    }

    function countlimit(maxlength,e,placeholder){
    var theform=eval(placeholder)
    var lengthleft=maxlength-theform.value.length
    var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
    if (window.event||e.target&amp;&amp;e.target==eval(placeholder)){
    if (lengthleft<0)
    theform.value=theform.value.substring(0,maxlength)
    placeholderobj.innerHTML=lengthleft
    }
    }


    function displaylimit(theform,thelimit){
    var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b> <?echo $la_mod_cont_char?> '
    if (document.all||ns6)
    document.write(limit_text)
    if (document.all){
    eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
    eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
    }
    else if (ns6){
    document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true);
    document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true);
    }
    }
    -->
    </script>
    <form name="form" action="contact_us.php?session=$session" method="post" >
    <table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td width="150" align="left"><strong><?echo $la_mod_cont_name?></strong></td>
    <td><input name="from_name" value="<?php echo $from_name; ?>" type="text" class="textbox" size="30" maxlength="30"><font color="#990000"> *</font></td>
    </tr>
    <tr>
    <td width="150" align="left"><strong><?echo $la_mod_cont_addr?></strong></td>
    <td><input name="from_email" value="<?php echo $from_email; ?>" type="text" class="textbox" size="30" maxlength="30"><font color="#990000"> *</font></td>
    </tr>
    <tr>
    <td width="150" align="left"><strong><?echo $la_mod_cont_department?></strong></td>
    <td><select name="to_email" value="<?php echo $to_email; ?>">
    <option selected value="Please Select Department">Please Select Department
    </option>
    <option value="test1@test.com">Sales</option>
    <option value="test2@test.com">Technical Support</option>
    <option value="test3@test.com">Webmaster</option>
    <option value="test4@test.com">Affiliates</option>
    </select><font color="#990000"> *</font></td>
    </tr>
    <td width="150" align="left"><strong><?echo $la_mod_cont_subject?></strong></td>
    <td><input name="subject_email" value="<?php echo $subject_email; ?>" type="text" class="textbox" size="30" maxlength="30"><font color="#990000"> *</font></td>
    </tr>
    <tr>
    <td align="left" valign="top"><strong><?echo $la_mod_cont_mess?></strong></td>
    <td valign="top"><textarea name="message" cols="54" rows="10" id="message"><?php echo $message; ?></textarea><br><script language="javascript">displaylimit("document.form.message",1024)</script>
    </td>
    </tr>
    <tr>
    <td width="150" align="left" valign="top">&nbsp;</td>
    <td><input type="submit" name="submit" class="submit" value="<?echo $la_mod_cont_send?>"><br> <?echo $la_account_form_must?></td>
    </tr>
    </table>
    </form>
    <?
    }//end if no submit

    // end border
    eb($bg_colour,$colour_1);

    include("subfooter.inc.php");
    include("footer.inc.php");


    Thanks for your time and help in advance

    James

  2. #2
    loanskey's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2006
    Posts
    11

    Re: Please help with email form script

    PHP Code:
    $email $contact_email;
    $headers "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: ".$sender_email."\r\n"
    // the abpve is for sending mimie type email
    $message nl2br($_POST['message'])."<br><br>";
    $subject $_POST['subject'];
     
    //email is sent here 
    if(@mail($email$subject$message$headers)){
    echo 
    "Your message has been recieved. Thank You.!!";
    } else {
    echo 
    "Sorry your message cannot be delivered.!!";

    I hope this should help you

    Ravish Kumar
    Last edited by HTML; 04-07-2006 at 05:57 AM.



Tags for this Thread