www.webdeveloper.com
Results 1 to 6 of 6

Thread: Forms Drive Me Nuts!

  1. #1
    Join Date
    Apr 2003
    Location
    Nevada
    Posts
    411

    Forms Drive Me Nuts!

    Here is the source code...

    <HTML>
    <HEAD>
    <META http-equiv="Page-Enter" CONTENT="RevealTrans(Duration=2,Transition=3)">
    <TITLE>Prayer Requests</TITLE>
    <body bgcolor="#3399FF">
    <body text="black">
    </head>

    <body>
    <H1>Prayer Requests</h1>
    <HR>
    <h3>Please enter your prayer request below.</h3>
    <BR>
    <Form method="post" action="mailto:support@crosspoint.org" enctype="text/plain">
    Type your prayer here:<br>
    <Textarea name="Pray for this:" Rows=20 cols=40></textarea>
    <BR>
    <FIELDSET>
    <LEGEND><b>~Remember~</b></LEGEND>
    Your prayer needs are confidential, so you don’t need to give an e-mail address.<BR>
    <BR>
    But if you would like one of the pastors or other leaders to contact you, then please enter you e-mail below.<BR>
    <input type="text" name="E-mail:" Size="30">
    <BR>
    </fieldset>
    <BR>
    <P>
    <input type="submit" value="SEND YOUR PRAYER"><input type="reset" value="RESET INFORMATION">
    </form>
    <BR>
    <BR>
    </body>
    </html>

    So how come when you click submit it just goes to a regular mailto: command?... the website is here: www.crosspoint.org/Prayer.html

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    <Form method="post" action="mailto:support@crosspoint.org" enctype="text/plain">

    What is it that you want this form to do?
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Nov 2002
    Posts
    2,632
    It's going to the mailto: command becasue that's what you are telling it to do in your code. <Form method="post" action="mailto:support@crosspoint.org" enctype="text/plain">

    What server side code are you allowed to use? Here's what I have for my site, but it uses PHP. If you can't use PHP then ignore this part.

    Here's my form...

    <form method="post" action="confirm.php">
    <div>Name:</div>
    <div><input type="text" name="Name" /></div>
    <div><sup class="req">*</sup>E-mail:</div>
    <div><input type="text" name="EMail" /></div>
    <div>Comments:</div>
    <div><textarea cols="50" rows="5" name="Comments"> </textarea></div>
    <div>
    <input type="submit" value="Submit" />
    <input type="reset" value="Reset" />
    </div>
    </form>

    Here's the PHP on my confirm.php page...

    <!-- Begin edit here -->
    <?php
    header("Refresh: 3; URL=/index.html");
    echo " "; // NN4 requires that we output something...
    exit();
    $msg = "Email from your website.\n";
    $msg .= "From: $Name \n";
    $msg .= "E-Mail: $EMail \n";
    $msg .= "$Comments";
    $email_to = "me@matts-website.net";
    $frome = "From: $EMail";
    $subject_line = "Matt's Website e-mail.";
    $Name = trim($Name);
    mail($email_to,$subject_line,$msg,$frome);
    echo "Your email has been sent to me and I will read it as soon as possible.";
    ?>
    <!-- End edit here -->

    I also added this <meta> tag in my confirm.php page to refresh the page to my home page.

    <meta http-equiv="refresh" content="5; url=index.html">

    Hmm, I already have a refresh in my header info. I'll have to play around with this to make it correct, but it still should work.
    Last edited by spufi; 06-27-2003 at 12:33 AM.

  4. #4
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    If I may make a suggestion about your PHP code, I would say that you should program assuming global variables are off, as they now are as a default since PHP 4.2.0 (though many hosts manually turn them on). So, this line:
    $msg .= "From: $Name \n";
    should be:
    $msg .= "From: $_POST["Name"]\n";

    and the rest would be along those same lines.

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

  5. #5
    Join Date
    Nov 2002
    Posts
    2,632
    Well that's what I fet for taking code from somebody else. I'll rework the code later on today. Thanks.

  6. #6
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    lol...

    While you are switching, you may just want to use a loop to loop through all the $_POST vars. That way, if you ever use a form with more than message files, it won't be a problem. Something like this one here: http://forums.webdeveloper.com/showt...9543#post48748

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

Thread Information

Users Browsing this Thread

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

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