name attribute in input tag

Discussion in 'HTML' started by eggie, Sep 8, 2003.

  1. eggie

    eggie Guest

    I was wondering is it possible to use the name attribute e.g. <input name =
    "name" type = "text" etc.
    in forms to let the user fill in an email address in a text field and the
    form be sent to that address.

    I tried <form action = "mailto:name" more in hope than expectation but
    didn't get anywhere?

    Is there a solution to this?
     
    eggie, Sep 8, 2003
    #1
    1. Advertising

  2. eggie

    eggie Guest

    mm
    "eggie" <> wrote in message
    news:AJ37b.18904$...
    > I was wondering is it possible to use the name attribute e.g. <input name

    =
    > "name" type = "text" etc.
    > in forms to let the user fill in an email address in a text field and the
    > form be sent to that address.
    >
    > I tried <form action = "mailto:name" more in hope than expectation but
    > didn't get anywhere?
    >
    > Is there a solution to this?
    >
    >
     
    eggie, Sep 8, 2003
    #2
    1. Advertising

  3. eggie

    Adrienne Guest

    Gazing into my crystal ball I observed "eggie" <>
    writing in news:iQ37b.19062$:

    > mm
    > "eggie" <> wrote in message
    > news:AJ37b.18904$...
    >> I was wondering is it possible to use the name attribute e.g. <input
    >> name = "name" type = "text" etc.
    >> in forms to let the user fill in an email address in a text field and
    >> the form be sent to that address.
    >>
    >> I tried <form action = "mailto:name" more in hope than expectation but
    >> didn't get anywhere?
    >>
    >> Is there a solution to this?
    >>
    >>

    >
    >
    >


    <form id="mailing" action="mailingscript" method="post">
    <fieldset>
    <legend>Your mailing information</legend>
    <label for="yourname">Name: </label><input type="text" name="yourname"
    id="yourname" value="">
    <label for="email">Email: </label><input type="text" name="email"
    id="email" value="">
    <input type="submit" value="Submit">
    </fieldset>
    </form>

    Upon submission of the form, name value pairs are posted to the processing
    script. As you saw in your example, using mailto for action does not work
    very well.

    Check with your host to find out what the mailing script name is, and what
    parameters it requires. If your host does not provide a form processing
    script, you could use something like http://www.response-o-matic.com .

    --
    Adrienne Boswell
    Please respond to the group so others can share
    http://www.arbpen.com
     
    Adrienne, Sep 8, 2003
    #3
  4. eggie wrote:

    > I was wondering is it possible to use the name attribute e.g. <input name =
    > "name" type = "text" etc.
    > in forms to let the user fill in an email address in a text field and the
    > form be sent to that address.


    Yes, but not in a way like you described.

    You would need a server-side script to do this. For example with PHP...

    form.html should contain:

    <form action="handler.php" method="POST">
    <p>
    <input type="text" name="email"> E-mail (From)<br>
    <input type="text" name="email2"> E-mail (To)<br>
    <input type="text" name="subject"> Subject<br>
    <input type="text" name="msg"> Short Message
    </p>
    <p>
    <input type="submit">
    </p>
    </form>

    and handler.php would consist of:

    <?php
    // specify a page to redirect to afterwards.
    $redirect = 'http://www.example.org/thanks.html';

    $hdrs = 'From: ' . $_POST['email'] . "\r\n"
    . 'X-Originating-IP: ' . getenv('REMOTE_ADDR') . "\r\n"
    . 'X-Mailer: PHP/' . phpversion();
    $to = $_POST['email2'];
    $subj = $_POST['subject'];
    $msg = $_POST['msg'];

    mail($to,$subj,$msg,$hdrs);
    header("Location: $redirect");
    ?>

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?id=132
     
    Toby A Inkster, Sep 8, 2003
    #4
  5. Toby A Inkster wrote:

    > eggie wrote:


    > <input type="text" name="email2"> E-mail (To)<br>


    But this is an incredibly poor idea, as it will take no time at all
    before your mail script is misused to send spam out to the masses.
     
    Owen Jacobson, Sep 8, 2003
    #5
  6. eggie

    eggie Guest

    THANKS TO ALL WHO REPLIED



    "eggie" <> wrote in message
    news:AJ37b.18904$...
    > I was wondering is it possible to use the name attribute e.g. <input name

    =
    > "name" type = "text" etc.
    > in forms to let the user fill in an email address in a text field and the
    > form be sent to that address.
    >
    > I tried <form action = "mailto:name" more in hope than expectation but
    > didn't get anywhere?
    >
    > Is there a solution to this?
    >
    >
     
    eggie, Sep 9, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shruds
    Replies:
    1
    Views:
    834
    John C. Bollinger
    Jan 27, 2006
  2. ding feng
    Replies:
    2
    Views:
    2,822
    ding feng
    Jun 25, 2003
  3. David Wright

    input attribute for the input tag?

    David Wright, Dec 19, 2006, in forum: HTML
    Replies:
    1
    Views:
    339
    Jukka K. Korpela
    Dec 20, 2006
  4. Sumit Rawat India
    Replies:
    1
    Views:
    512
    bruce barker
    Oct 11, 2008
  5. Pavils Jurjans
    Replies:
    3
    Views:
    189
    Pavils Jurjans
    Mar 18, 2005
Loading...

Share This Page