How to process text from HTML form?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Geoff Berrow

    #16
    Re: How to process text from HTML form?

    I noticed that Message-ID:
    <MfBMc.96751$4G 3.39536@newssvr 29.news.prodigy .com> from deko contained
    the following:
    [color=blue]
    >Perhaps I shouldn't have a separate script to send the message - can I merge
    >send_mail.ph p into the form code on contact.php? Not sure this would solve
    >the problem... which I'm sure is something elementary...[/color]

    It is.

    The action part of the form should be the location of the page the
    results should be sent to. If you leave it blank it will simply refresh
    the page. Your script is including the script in the action rather than
    the location of the script.

    Try:

    <form method="POST" action=
    "<?
    if ( empty($_POST['message']) || empty($_POST['email_address']) )
    {
    }
    else
    {
    echo "send_mail.php" ;
    }
    ?>"
    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    • deko

      #17
      Re: How to process text from HTML form?

      > The action part of the form should be the location of the page the[color=blue]
      > results should be sent to. If you leave it blank it will simply refresh
      > the page. Your script is including the script in the action rather than
      > the location of the script.[/color]

      Thanks - the below code is working.

      I merged send_mail.php into the form code, and commented out the "header..."
      line. But I don't know how to move to thankyou.html when the input is
      accepted.

      <form method="POST" action=
      "<?
      if ( empty($_POST['message']) || empty($_POST['email_address']) )
      {
      }
      else
      {
      $email = $_REQUEST['email_address'];
      $message = $_REQUEST['message'];
      mail( "me@mydomain.co m, "CSI Feedback Form", $message, "From:
      $email_address" );
      //header( "Location: http://www.mydomain.co m/thankyou.html" );
      //How to move to above page?
      }
      ?>"
      style="font-family: Arial, Helvetica, sans-serif; font-size:12px">
      Email address: <input name="email_add ress" type="text" /><br />
      Message:<br />
      <textarea name="message" rows="12" cols="25"></textarea><br />
      <input type="submit" value="Send" style="font-family: Arial, Helvetica,
      sans-serif">
      </form>


      Comment

      • Geoff Berrow

        #18
        Re: How to process text from HTML form?

        I noticed that Message-ID:
        <XVUMc.97081$wt 5.61703@newssvr 29.news.prodigy .com> from deko contained
        the following:
        [color=blue]
        >
        >I merged send_mail.php into the form code, and commented out the "header..."
        >line. But I don't know how to move to thankyou.html when the input is
        >accepted.[/color]

        Try doing what I suggested instead.

        --
        Geoff Berrow (put thecat out to email)
        It's only Usenet, no one dies.
        My opinions, not the committee's, mine.
        Simple RFDs http://www.ckdog.co.uk/rfdmaker/

        Comment

        Working...