34 users online (0 members and 34 guests)  


Page 1 of 2 1 2 Last
  Results 1 to 15 of 30

Related

  1. Replies: 1
  2. Replies: 4
  3. Replies: 1
  4. Form Handling Script for 'Tell A Friend' Form    Forum: Javascript Forum
    Replies: 1
  5. Replies: 3
  1. #1
    Mr. Blue's Avatar
    Evil twin of Dave

    Status
    Offline
    Join Date
    Jul 2001
    Location
    MA, USA
    Posts
    148

    Arrow PHP Form help....

    I'm really a n00b at this stuff and I'm not even the one who wrote the code for the form. My friend wrote it for our new site design but doesn't know how to make the form write to PHP instead of using default mail program like Outlook Express for me. This is the link: http://colorconcepts.ukterrorist.com/wip/contact (I know he told me he wants it to write to PHP but I'm not exactly sure why or what that involves.....so bear with me please) Thx in advance cause I know you all are so busy and have your own lives and problems to deal with.

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    You need the <form action=" to point at a php script.

    If you give me ten minutes, I'll post a generic email processor here.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    Mr. Blue's Avatar
    Evil twin of Dave

    Status
    Offline
    Join Date
    Jul 2001
    Location
    MA, USA
    Posts
    148
    /me does a happy dance! Whooohoooo!

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Here we go, I have done a very strange processor, but it works. The advantage of the way I have code it is that you can point ANY form at this, and it will pick up the names of the inputs, and send them in an email. SO it doesn't matter how many fields you have in your form, as long as they have name="something" the emailer will send them -

    PHP Code:
    <?
    // Filename: mailer.php

    // Generic Emailer

    // Default Settings 

    $recipient "dean@somepeople.net";

    $redirect "My_thank_you_page.html";



    // First, detects whether info is received via form -



    $subject "Email From my Website";

    $from "From: My Website Emailer";

    $email "
    "
    ;

    $data $HTTP_POST_VARS;
        
        foreach(
    $data as $k => $v) {
           
        
    $k stripcslashes($k);
        
    $v stripcslashes($v);
           
         
    $email .= "\n$k : $v";
         
         
           
        }


    mail($recipient$subject$email$from);

    header("Location: $redirect");



    ?>
    Heres the form I used, just a changed version of yours -

    Code:
    <html>
    <head>
    <TITLE>COLOR Concepts -  Your Source For Digital Artwork - [CONTACT]</TITLE>
    <style type="text/css">
    <!-- BODY, TABLE, DIV, P
    a { font: 7pt verdana; color: #000000; text-decoration: none; }
    a:link { color: #CCCCCC; text-decoration: none;}
    a:active { color: #000000; text-decoration: underline; }
    a:visited { color: #CCCCCC; text-decoration: none }
    a:hover { color: #000000; text-decoration: underline; }
    BODY {scrollbar-3d-light-color:#171582;
    scrollbar-arrow-color:#FFFFFF;
    scrollbar-base-color:#FFFFFF;
    scrollbar-dark-shadow-color:#000000;
    scrollbar-face-color:#000000;
    scrollbar-highlight-color:#FFFFFF;
    scrollbar-shadow-color:#000000}
    -->
    </style>
    </head>
    <body>
    <center>
    <form action="mailer.php" method="post">
    
    Name:
    <input type="text" name="Name">
    Email:
    <input type="text" name="Email">
    <br>
    Message:
    <br>
    <textarea rows="10" cols="45" name="content">
    ::Place your msg here::
    </textarea>
    <br>
    
    
    <input type="submit" value="Submit">
    <input type="reset" value="Reset">
    
    </form>
    </center>
    </body>
    </html>
    Try it.
    Last edited by QuietDean; 11-11-2003 at 06:10 AM.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    Mr. Blue's Avatar
    Evil twin of Dave

    Status
    Offline
    Join Date
    Jul 2001
    Location
    MA, USA
    Posts
    148
    Ok thx, this should do nicely.....yet I have no idea what to do now. I'm guessing to copy all the script code into a file and name it mailer.php? then use your modified code for the page code and it should work? This heat is killing me......thx so far though.

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Thats exactly right. The only thing to watch is, when you paste in the code for mailer.php, make sure that the <? is the VERY first character in the file. No white space, no line break. It will still work, but it will give an error and fail to redirect otherwise.

    Dont worry about adding for form fields, it can handle any amount. Also, avoid the 'enctype' declaration, seems to muck up the HTTP_POST_VARS , and you get an empty email.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  7. #7
    Mr. Blue's Avatar
    Evil twin of Dave

    Status
    Offline
    Join Date
    Jul 2001
    Location
    MA, USA
    Posts
    148
    Ok I got everything pretty much setup, but I'd like to tweak it a bit. Here is what I have for the HTML Code:
    Code:
    <html>
    <head>
    <TITLE>COLOR Concepts -  Your Source For Digital Artwork - [CONTACT]</TITLE>
    <style type="text/css">
    <!-- BODY, TABLE, DIV, P
    a { font: 7pt verdana; color: #000000; text-decoration: none; }
    a:link { color: #CCCCCC; text-decoration: none;}
    a:active { color: #000000; text-decoration: underline; }
    a:visited { color: #CCCCCC; text-decoration: none }
    a:hover { color: #000000; text-decoration: underline; }
    BODY {scrollbar-3d-light-color:#171582;
    scrollbar-arrow-color:#FFFFFF;
    scrollbar-base-color:#FFFFFF;
    scrollbar-dark-shadow-color:#000000;
    scrollbar-face-color:#000000;
    scrollbar-highlight-color:#FFFFFF;
    scrollbar-shadow-color:#000000}
    -->
    </style>
    <script language="javascript" type="text/javascript" src="chromeless.js"></script>
    <script language="javascript">
    function openIT(u,W,H,X,Y,n) {
    var cD ='images/close.gif'
    var cU ='images/close.gif'
    var cO ='images/close.gif'
    var cL
    var tH ='<font face=arial size=1><b>.::COLORCONCEPTS::.</b></font>'
    var tW ='COLOR Concepts'
    var wB ='#000000'
    var wBs ='#000000'
    var wBG ='#FFFFFF'
    var wBGs='#FFFFFF'
    var wNS ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'
    var fSO ='scrolling=no noresize'
    chromeless(u,n,W,H,X,Y,cD,cU,cO,cL,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO)
    }
    </script>
    </head>
    <body>
    <center>
    <form action="mailer.php" method="post">
    
    Name:
    <input type="text" name="Name">
    Email:
    <input type="text" name="Email">
    <br>
    Message:
    <br>
    <textarea rows="10" cols="45" name="content">
    ::Place your msg here::
    </textarea>
    <br>
    
    
    <input type="submit" value="Submit">
    <input type="reset" value="Reset">
    
    </form>
    </center>
    </body>
    </html>
    and for the mailer.php file this is what I have:
    PHP Code:
    <?
    // Filename: mailer.php

    // Generic Emailer

    // Default Settings 

    $recipient "dave@colorconceptsdesign.com";

    $redirect "thankyou.html";



    // First, detects whether info is received via form -



    $subject "Contact Message";

    $from "From: COLOR Concepts Design Contact Form";

    $email "
    "
    ;

    $data $HTTP_POST_VARS;
        
        foreach(
    $data as $k => $v) {
           
        
    $k stripcslashes($k);
        
    $v stripcslashes($v);
           
         
    $email .= "\n$k : $v";
         
         
           
        }


    mail($recipient$subject$email$from);

    header("Location: $redirect");



    ?>
    What I'd like to do here is take what they add in the Email Address Box on the Form and put it as the Sender of the email when I recieve it if at all possible. Also I'd like to change it so that when you hit the submit button a small box with a thank you message pops up using this code:
    Code:
    javascript:openIT('thankyou.html',200,200,null,null,'thankyou');
    which goes along with the code at the top of the HTML code and if possible just reset while staying on the same page. To clarify I'd like to put this last bit of code in after $redirect = "IN HERE" Wow....I feel like such a Grinch, oh well we'll see what goes on here and I really appreciate any help you can give.
    -Dave
    Last edited by Mr. Blue; 04-17-2002 at 06:14 PM.

  8. #8
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    why don't you just do something like this:
    PHP Code:
    <?php
    // Filename: mailer.php

    // Generic Emailer

    // Default Settings 

    $recipient "dave@colorconceptsdesign.com";

    // First, detects whether info is received via form -



    $subject "Contact Message";

    $from "From: COLOR Concepts Design Contact Form";

    $email "
    "
    ;

    $data $HTTP_POST_VARS;
        
        foreach(
    $data as $k => $v) {
           
        
    $k stripcslashes($k);
        
    $v stripcslashes($v);
           
         
    $email .= "\n$k : $v";
         
         
           
        }


    mail($recipient$subject$email$from);

    echo 
    "Thank you for e-mailing me. I will reply to your e-mail as soon as possible. Click <a href='index.html'>Here</a> to return to home page.";

    ?>
    the e-mail thing u don't need cause you got that from dean but instead of using JavaScript you should just echo out the message. That way you stay on the same page. Well you can do either but for you it would probably be easier. AND you were SUPPOSED to ask me PM! (because of my debt for the logo), haha, well dean worked it to so o well.

  9. #9
    Mr. Blue's Avatar
    Evil twin of Dave

    Status
    Offline
    Join Date
    Jul 2001
    Location
    MA, USA
    Posts
    148
    I'm discussing it here because Dave made a post about the large number of PMs and I feel that it could benefit others that are new to the whole PHP thing like I am. I'm at school right now so I can't test out the new mailer.php but the way the new page is setup It'd be ideal if instead of going to a whole new page after submitting, it popped up the thankyou message in a javascript popup and cleared the form as well. That is what I'd like to do if anyone can help or if that's even possible. Also what about when the mail is sent to me....can I take what they input in the form at the "Email" field and have that put as the sender when I recieve it?
    **EDIT** I already have a Borderless window javascript that I use on the other parts of my website, I just need to figure out if It can be implemented this way.**/EDIT**
    Last edited by Mr. Blue; 04-18-2002 at 10:56 AM.

  10. #10
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    It is possible to get this working with a popup, however, it will take some re-working of the code. I will give it some thought.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  11. #11
    Mr. Blue's Avatar
    Evil twin of Dave

    Status
    Offline
    Join Date
    Jul 2001
    Location
    MA, USA
    Posts
    148
    Ok Dean I really appreciate it, I know how much new people with Photoshop etc. like it when I give them help so I thank you for taking your own time to work on my problems.

    -The Other Dave

  12. #12
    Mr. Blue's Avatar
    Evil twin of Dave

    Status
    Offline
    Join Date
    Jul 2001
    Location
    MA, USA
    Posts
    148
    bah now I get an error which goes like this...
    Code:
    Parse error: parse error, expecting `','' or `';'' in /.../mailer.php on line 76
    I elipsed the address just cause it's a work in progress and I'd like to keep it under wraps until it's released..but the actuall address does show up.

    Oh yeah here's the code for the mailer.php
    PHP Code:
    <html>
    <head>
    <TITLE>COLOR Concepts -  Your Source For Digital Artwork - [Thank You!]</TITLE>
    <style type="text/css">
    <!-- BODY, TABLE, DIV, P
    a { font: 7pt verdana ; color: #000000; text-decoration: none; }
    a:link { color: #0000FF; text-decoration: none;}
    a:active { color: #0000FF; text-decoration: underline; }
    a:visited { color: #0000FF; text-decoration: none }
    a:hover { color: #0000FF; text-decoration: underline; }
    BODY {scrollbar-3d-light-color:#171582; 
    scrollbar-arrow-color:#FFFFFF; 
    scrollbar-base-color:#CCCCCC; 
    scrollbar-dark-shadow-color:#000000; 
    scrollbar-face-color:#CFCFCF; 
    scrollbar-highlight-color:#FFFFFF; 
    scrollbar-shadow-color:#000000}
    -->
    </style>
    <script language="javascript" type="text/javascript" src="chromeless.js"></script>
    <script language="javascript">
    function openIT(u,W,H,X,Y,n) {
    var cD ='images/close.gif'
    var cU ='images/close.gif'
    var cO ='images/close.gif'
    var cL
    var tH ='<font face=arial size=1><b>.::COLORCONCEPTS::.</b></font>'
    var tW ='COLOR Concepts'
    var wB ='#000000'
    var wBs ='#000000'
    var wBG ='#FFFFFF'
    var wBGs='#FFFFFF'
    var wNS ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'
    var fSO ='scrolling=no noresize'
    chromeless(u,n,W,H,X,Y,cD,cU,cO,cL,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO)
    }
    </script>
    </head>
    <body>
    <?php
    // Filename: mailer.php

    // Generic Emailer

    // Default Settings 

    $recipient "dave@colorconceptsdesign.com";

    // First, detects whether info is received via form -



    $subject "Contact Message";

    $from "From: COLOR Concepts Design Contact Form";

    $email "
    "
    ;

    $data $HTTP_POST_VARS;
        
        foreach(
    $data as $k => $v) {
           
        
    $k stripcslashes($k);
        
    $v stripcslashes($v);
           
         
    $email .= "\n$k : $v";
         
         
           
        }


    mail($recipient$subject$email$from);

    echo 
    "Thank You For Your Submission, You May Now Return To Viewing The Rest Of Our Site By Clicking <a href="news.php">Here</a>.";

    ?>
    </body>
    </html>
    Please don't rip my head off....i'm probably doing some stupid things, but I needed to add in that CSS stuff to change the font to the correct font which agrees with the rest of the site etc....I don't even know if I need those extra HTML tags in there...probably not. I'm acutally laughing right now cause I'm making things difficult.
    Last edited by Mr. Blue; 04-18-2002 at 05:35 PM.

  13. #13
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    PHP Code:
    echo "Thank You For Your Submission, You May Now Return To Viewing The Rest Of Our Site By Clicking <a href="news.php">Here</a>."
    on the "news.php" should be changed to 'news.php' because you can't put doulbe quotes together, but you can put double then single quotes inside of the double. I think that is your problem. And the echo"x" part does not send you to a new page, instead of having a pop-up window it "re-writes" the current page and puts what you wuld put in the popup on the "rewritten" page, never redirecting to a different one. Do you just like the pop-up better or was that your problem?

  14. #14
    Mr. Blue's Avatar
    Evil twin of Dave

    Status
    Offline
    Join Date
    Jul 2001
    Location
    MA, USA
    Posts
    148
    Hmmmmm, maybe I'm just not explaining myself correctly. This is the ideal situation that I'd like to happen:
    [list=1][*]The website viewer clicks submit on the Contact Page Form[*]A popup window comes up with the thank you message in it[*]The Form is cleared[*]During this time the email has been sent[/list=1]

    On the rest of my page I can use this JavaScript:
    Code:
    <script language="javascript" type="text/javascript" src="chromeless.js"></script>
    <script language="javascript">
    function openIT(u,W,H,X,Y,n) {
    var cD ='images/close.gif'
    var cU ='images/close.gif'
    var cO ='images/close.gif'
    var cL
    var tH ='<font face=arial size=1><b>.::COLORCONCEPTS::.</b></font>'
    var tW ='COLOR Concepts'
    var wB ='#000000'
    var wBs ='#000000'
    var wBG ='#FFFFFF'
    var wBGs='#FFFFFF'
    var wNS  ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'
    var fSO ='scrolling=no noresize'
     chromeless(u,n,W,H,X,Y,cD,cU,cO,cL,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO)
    }
    </script>
    Combined with a link like this:
    Code:
    javascript:OpenIT('thankyou.html',200,200,null,null,'thankyou');
    But I don't know where I can put that to make it work when you submit the form.
    Last edited by Mr. Blue; 04-18-2002 at 07:22 PM.

  15. #15
    Derek's Avatar
    Be Yourself

    Status
    Offline
    Join Date
    Aug 2001
    Location
    St. George, Utah, USA
    Posts
    466
    ok assuming that the form action is not for a different page, this should work:
    PHP Code:
    <html>

    <head>

    </head>

    <body>

    <form method=POST action="mail.php"(assuming this current page is mail.php)>
    Name: <input type="text" name="name">
    Subject: <input type="text" name="subject">
    E-mail: <input type="text" name="email">
    <textarea name="message" cols=45></textarea>
    <input type="Submit" value="Submit" name="submit">
    </form>
    <?php
    strip_tags
    ($name);
    strip_tags($subject);
    strip_tags($email);
    strip_tags($message);
    mail("webmaster@colorconcepts.com""$subject""
    Name: 
    $name\n
    Message: 
    $message\n""From: Color Concepts Contact Form\nReply-to: $email\n");

    if (
    $submit) {
    echo 
    "
    <script language='javascript'>
    <!--
    alert('Thank you for contacting me. I will try to reply as soon as possible.')
    -->
    </script>"
    ;
    }
    ?>
    </body>
    </html>
    or if you really want the new window change the last part to:
    PHP Code:
    if ($submit) {
    echo 
    "
    <script language='javascript' type='text/javascript' src='chromeless.js'></script>
    <script language='javascript'>
    function openIT(u,W,H,X,Y,n) {
    var cD ='images/close.gif'
    var cU ='images/close.gif'
    var cO ='images/close.gif'
    var cL
    var tH ='<font face=arial size=1><b>.::COLORCONCEPTS::.</b></font>'
    var tW ='COLOR Concepts'
    var wB ='#000000'
    var wBs ='#000000'
    var wBG ='#FFFFFF'
    var wBGs='#FFFFFF'
    var wNS   ='toolbar=0,location=0,directories=0,status=0,menu
    bar=0,scrollbars=0,resizable=0'
    var fSO ='scrolling=no noresize'
      chromeless(u,n,W,H,X,Y,cD,cU,cO,cL,tH,tW,wB,wBs,wB
    G,wBGs,wNS,fSO)
    }
    </script>
    <body onload=javascript:OpenIT('thankyou.html',200,200,null,null,'thankyou')>
    "
    ;
    }
    ?>
    </body>
    </html> 
    will probably work. But don't count on it to heavily this is untested (the javascript part).

    sorry dean for rewriting the mail script but in order to get my brain workin with the rest of the page in the right direction I had to write the one I'm familiar with lol.
    Last edited by Derek; 04-18-2002 at 10:57 PM.



Page 1 of 2 1 2 Last

Tags for this Thread