www.webdeveloper.com
Results 1 to 15 of 15

Thread: special form and button code please

Hybrid View

  1. #1
    Join Date
    Mar 2011
    Location
    Souderton, PA
    Posts
    9

    special form and button code please

    I am looking to have a simple form to collect info from vistors and once they fill out the info and click the button, I want their info to go to my email or contact management software and also once the click the button I want them to be directed to an external page. You're help would be much appreciated. Thanks in advance.

  2. #2
    Join Date
    Feb 2011
    Posts
    231
    Hy,
    Check the tutorial on this page: PHP Sending E-mails, it has an example and code for a simple form contact script

  3. #3
    Join Date
    Mar 2011
    Location
    Souderton, PA
    Posts
    9
    ok so I have the emailing info part down but still don't know how to on that one click get it to send them to external page, please help.

  4. #4
    Join Date
    Feb 2011
    Posts
    231
    You can add the php script separately in an external php file, ex. "script.php, then, at the action attribute of the form put action="script.php".
    On click on the submit button will send data to, and open that file

  5. #5
    Join Date
    Mar 2011
    Location
    Souderton, PA
    Posts
    9
    I'm sorry, I'm totally clueless about this stuff. Here is the code that has my form complete. Please add the php stuff so I can understand please. Thanks.

    <script type="text/javascript" src="http://app1.talkfusion.com/fusion2/widget.asp?15299_6244%7C300%7C%7C%7C%7C%7C%7CLearn%20More%7CGo"></script>

  6. #6
    Join Date
    Feb 2011
    Posts
    231
    Sorry, but I can't help with that, I don't know that kind of code.

  7. #7
    Join Date
    Mar 2011
    Location
    Souderton, PA
    Posts
    9
    Could you at least show me how it might look? Then I will try it. Because I don't know the slightest thing about the php code. And the external page I want to send them to is http://derek.talkfusionservice.com. I saw you know how to put this in as a php so maybe if you could just show me how it might look, I will mess around with it and try it.

  8. #8
    Join Date
    Feb 2011
    Posts
    231
    If the external page isn't on your server, and you don't have access to the code of that page, is more complicated. Something with cURL , but i don't know how.

  9. #9
    Join Date
    Mar 2011
    Location
    Souderton, PA
    Posts
    9
    the external page is on the server however I don't have access to the code on that page.

  10. #10
    Join Date
    Mar 2011
    Location
    Souderton, PA
    Posts
    9
    I think I almost have it. I have the php script for the mail function done but how do I make it go to the external webpage. I have an action prompt inside my normal html coding that does it. Am I able to have 2 action prompts inside html?

    Here is what I have so far for my HTML, and then lower I will include the PHP:

    <FORM ACTION="http://derek.talkfusionservice.com"
    METHOD="POST">
    <center>Your Name</center><span></span><center><INPUT NAME="FName" /></center><center>Email Address</center><span></span><center><input type="text" /></center>
    <center><input type=Submit value="GO" /></center>
    </form>

    <?php
    $to = 'nobody@example.com';
    $subject = 'Talk Fusion Info';
    $message = 'I would like information on the products';
    $headers = 'From: derek.dimmick@gmail.com' . "\r\n" .
    'Reply-To: derek.dimmick@gmail.com' . "\r\n" .

    mail($to, $subject, $message, $headers);
    ?>

  11. #11
    Join Date
    Mar 2011
    Location
    Souderton, PA
    Posts
    9
    although the php script the nobody@example should be my email address. And what should the headers be if it would be sent from whoever is filling out the form.

  12. #12
    Join Date
    Mar 2011
    Location
    Souderton, PA
    Posts
    9
    Please someone help.

  13. #13
    Join Date
    Apr 2011
    Location
    I live in the pinaple under the sea
    Posts
    107
    Hi I don't really get what you mean, but if you want your viewer to redirect to whatever external page, you can use the PHP HEADER function to redirect you to external page after the mail has been successful sent.. something like this

    if(mail($to, $subject, $message, $headers))
    {
    header('Location: http://www.myExternalPage_blah_blah_blah_what_ever');
    }

  14. #14
    Join Date
    Mar 2011
    Location
    Souderton, PA
    Posts
    9
    Ok that makes sense, now where do I put that in my html for it work properly. My html is above also.

  15. #15
    Join Date
    Apr 2011
    Location
    I live in the pinaple under the sea
    Posts
    107
    Something like this
    HTML Code:
    <FORM ACTION="http://derek.talkfusionservice.com"
    METHOD="POST">
    <center>Your Name</center><span></span><center><INPUT NAME="FName" /></center><center>Email Address</center><span></span><center><input type="text" /></center>
    <center><input type=Submit value="GO" /></center>
    </form>
    
    <?php
    $to = 'nobody@example.com';
    $subject = 'Talk Fusion Info';
    $message = 'I would like information on the products';
    $headers = 'From: derek.dimmick@gmail.com' . "\r\n" .
    'Reply-To: derek.dimmick@gmail.com' . "\r\n" .
    
    if(mail($to, $subject, $message, $headers)) // this means that you successfully send the email
    {
          header('Location: http://www.myExternalPage_blah_blah_blah_what_ever');
    }else{
          // THER IS AN ERROR IN SENDING YOUR EMAIL
    }
    hope it will help you, but if you still encountering an error try to use free php mail library I suggest to use PHPMailer here's the site http://phpmailer.worxware.com/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles