Form submission .

Discussion in 'HTML' started by Vince Morgan, Oct 30, 2006.

  1. Vince Morgan

    Vince Morgan Guest

    Hi all,
    I have a form with about 10 fields. When I submit this form I
    would like it to send the cgi data for processing, and remain static.
    The form in part below;

    <form method="post" name="MSDSform" action="dummy.php" onSubmit="return
    checkSubmit();">
    <!-- inputs and selects -->
    <input type="submit" value=" Submit ">

    When I click the " Submit " button the browser jumps to nowhere, whereas I'd
    like it to just relax and sit there waiting for further entries.
    My html experience could be scratched onto a grain of rice with a broom
    handle, but I'm learning,, errr,, slowly.
    I realize this is a mixture of html and cgi, but it's the html part that's
    giving me the grief.
    Any help is very much appreciated,
    Regards,
    Vince Morgan
    Vince Morgan, Oct 30, 2006
    #1
    1. Advertising

  2. Vince Morgan

    Sandeep Guest

    Vince Morgan wrote:
    > Hi all,
    > I have a form with about 10 fields. When I submit this form I
    > would like it to send the cgi data for processing, and remain static.
    > The form in part below;
    >
    > <form method="post" name="MSDSform" action="dummy.php" onSubmit="return
    > checkSubmit();">
    > <!-- inputs and selects -->
    > <input type="submit" value=" Submit ">


    Check the return value for your function "checkSubmit", if it is always
    false, your form would never be submitted
    Sandeep, Oct 30, 2006
    #2
    1. Advertising

  3. Vince Morgan

    Vince Morgan Guest

    "Sandeep" <> wrote in message
    news:...
    >
    > Vince Morgan wrote:
    > > Hi all,
    > > I have a form with about 10 fields. When I submit this form

    I
    > > would like it to send the cgi data for processing, and remain static.
    > > The form in part below;
    > >
    > > <form method="post" name="MSDSform" action="dummy.php" onSubmit="return
    > > checkSubmit();">
    > > <!-- inputs and selects -->
    > > <input type="submit" value=" Submit ">

    >
    > Check the return value for your function "checkSubmit", if it is always
    > false, your form would never be submitted
    >

    Yes, the function checkSubmiit() returns true when the conditions are
    correct, and the form posts the data accordingly.
    That part is working fine. However, I don't think I explained my problem
    very well initialy.
    Presently, at the moment of submision, my page wants to jump to another page
    and throws a "HTTP 404". I would like it to post the data, and then wait
    for further submisions, ie remain static.
    Thanks,
    Vince Morgan
    Vince Morgan, Oct 30, 2006
    #3
  4. Vince Morgan wrote:
    > "Sandeep" <> wrote in message
    > news:...
    >> Vince Morgan wrote:
    >>> Hi all,
    >>> I have a form with about 10 fields. When I submit this form

    > I
    >>> would like it to send the cgi data for processing, and remain static.
    >>> The form in part below;
    >>>
    >>> <form method="post" name="MSDSform" action="dummy.php" onSubmit="return
    >>> checkSubmit();">
    >>> <!-- inputs and selects -->
    >>> <input type="submit" value=" Submit ">

    >> Check the return value for your function "checkSubmit", if it is always
    >> false, your form would never be submitted
    >>

    > Yes, the function checkSubmiit() returns true when the conditions are
    > correct, and the form posts the data accordingly.
    > That part is working fine. However, I don't think I explained my problem
    > very well initialy.
    > Presently, at the moment of submision, my page wants to jump to another page
    > and throws a "HTTP 404". I would like it to post the data, and then wait
    > for further submisions, ie remain static.


    Well of course if "dummy.php" doesn't exist you'll get a 404. Your
    form's ACTION *must* point to a real file! Now is can be the *same* file
    as your original form, i.e., post to itself.


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Oct 30, 2006
    #4
  5. Vince Morgan

    Vince Morgan Guest

    "Jonathan N. Little" <> wrote in message
    news:88896$45456f6a$40cba7c2$...
    > Vince Morgan wrote:
    > > "Sandeep" <> wrote in message
    > > news:...


    > Well of course if "dummy.php" doesn't exist you'll get a 404. Your
    > form's ACTION *must* point to a real file! Now is can be the *same* file
    > as your original form, i.e., post to itself.
    >
    >
    > --
    > Take care,
    >
    > Jonathan

    Thank you Jonathan,
    Well, dummy.php did exist, just not in that directory. Stupid, stupid, etc.
    That said it still won't do what I want.
    Is it at all possible to create a page, with inputs, that will allow me to
    add data and post it without the page wanting to change?
    A static type page from which I can post data?
    I actualy thought this would be quite easy.

    Regards,
    Vince Morgan
    Vince Morgan, Oct 30, 2006
    #5
  6. "Vince Morgan" <> wrote in message
    news:4545c71a$0$23136$...
    > "Jonathan N. Little" <> wrote in message
    > news:88896$45456f6a$40cba7c2$...
    >> Vince Morgan wrote:
    >> > "Sandeep" <> wrote in message
    >> > news:...

    >
    >> Well of course if "dummy.php" doesn't exist you'll get a 404. Your
    >> form's ACTION *must* point to a real file! Now is can be the *same* file
    >> as your original form, i.e., post to itself.
    >>
    >>
    >> --
    >> Take care,
    >>
    >> Jonathan

    > Thank you Jonathan,
    > Well, dummy.php did exist, just not in that directory. Stupid, stupid,
    > etc.
    > That said it still won't do what I want.
    > Is it at all possible to create a page, with inputs, that will allow me to
    > add data and post it without the page wanting to change?
    > A static type page from which I can post data?
    > I actualy thought this would be quite easy.
    >


    Could you maybe make dummy.php save the form variables to session variables
    (and do whatever other processing you're wanting to do), send a redirect
    header in dummy.php to your original form page and then use those session
    varables to fill the form values? Is that anything like you need?

    +e
    The Eclectic Electric, Oct 30, 2006
    #6
  7. Vince Morgan wrote:
    > "Jonathan N. Little" <> wrote in message
    > news:88896$45456f6a$40cba7c2$...
    >> Vince Morgan wrote:
    >>> "Sandeep" <> wrote in message
    >>> news:...

    >
    >> Well of course if "dummy.php" doesn't exist you'll get a 404. Your
    >> form's ACTION *must* point to a real file! Now is can be the *same* file
    >> as your original form, i.e., post to itself.
    >>
    >>
    >> --
    >> Take care,
    >>
    >> Jonathan

    > Thank you Jonathan,
    > Well, dummy.php did exist, just not in that directory. Stupid, stupid, etc.
    > That said it still won't do what I want.
    > Is it at all possible to create a page, with inputs, that will allow me to
    > add data and post it without the page wanting to change?
    > A static type page from which I can post data?
    > I actualy thought this would be quite easy.


    Look Vince if you want a form to actually submit the data the URL will
    change to whatever is in the ACTION property. That is just how forms
    work. If you don't go to the ACTION's url then the data is not
    transmitted. Now as I said you can give the appearance that the form is
    static by posting to yourself.

    //quagmire.php
    <?php
    if( isset($_POST['times']) ){
    $visits=$_POST['times'];
    $visits++;
    $msg="Welcome back, you have visited $visits time";
    }
    else {
    $visits=0;
    $msg="Welcome to the Quagmire, press the Submit button";
    }

    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Quagmire</title>
    </head>
    <body>
    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"
    enctype="application/x-www-form-urlencoded">
    <p><?php echo $msg; ?></p>
    <div>
    <input name="times" type="hidden" value="<?php echo $visits; ?>">
    <input type="submit">
    </div>
    </form>
    </body>
    </html>


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Oct 30, 2006
    #7
  8. Vince Morgan

    Vince Morgan Guest

    "Jonathan N. Little" <> wrote in message
    news:61aba$4546152a$40cba7a4$...
    > Look Vince if you want a form to actually submit the data the URL will
    > change to whatever is in the ACTION property. That is just how forms
    > work. If you don't go to the ACTION's url then the data is not
    > transmitted. Now as I said you can give the appearance that the form is
    > static by posting to yourself.
    >
    > //quagmire.php
    > <?php
    > if( isset($_POST['times']) ){
    > $visits=$_POST['times'];
    > $visits++;
    > $msg="Welcome back, you have visited $visits time";
    > }
    > else {
    > $visits=0;
    > $msg="Welcome to the Quagmire, press the Submit button";
    > }
    >
    > ?>
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    > "http://www.w3.org/TR/html4/strict.dtd">
    > <html>
    > <head>
    > <title>Quagmire</title>
    > </head>
    > <body>
    > <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"
    > enctype="application/x-www-form-urlencoded">
    > <p><?php echo $msg; ?></p>
    > <div>
    > <input name="times" type="hidden" value="<?php echo $visits; ?>">
    > <input type="submit">
    > </div>
    > </form>
    > </body>
    > </html>
    >
    >
    > --
    > Take care,
    >
    > Jonathan
    > -------------------

    I'm sorry I was more than a little slow getting the idea here. Your example
    behaves exactly as required and I apologize for not getting the picture
    earlier. Thank you very much indeed for the patience and taking the time to
    provide an example Jonathan.
    Highest regards,
    Vince Morgan.
    Vince Morgan, Oct 30, 2006
    #8
  9. Vince Morgan

    Vince Morgan Guest

    "Vince Morgan" <> wrote in message
    news:4545582f$0$11971$...
    The quality of the help here has been exceptional and I'm very grateful.
    Thank you all very much.

    Vince Morgan
    Vince Morgan, Oct 30, 2006
    #9
  10. Vince Morgan wrote:

    > I'm sorry I was more than a little slow getting the idea here. Your example
    > behaves exactly as required and I apologize for not getting the picture
    > earlier. Thank you very much indeed for the patience and taking the time to
    > provide an example Jonathan.


    No need to apologize, we all were beginners, I just wanted you to
    understand the process. You can post to the same script for multipage
    forms with a passed parameter to keep track of the 'step' your on, or
    cycle to add info until a condition and met and the server-side can
    conclude by changing the generated form's ACTION.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Oct 31, 2006
    #10
    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. Leon Shaw

    (onetime) Form Submission

    Leon Shaw, Aug 15, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    346
  2. Tim Stephenson

    Re: Offline Form Submission

    Tim Stephenson, Oct 15, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    381
    Tim Stephenson
    Oct 15, 2003
  3. Boban Dragojlovic

    duplicate form submission

    Boban Dragojlovic, Feb 2, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    549
    Boban Dragojlovic
    Feb 3, 2004
  4. KV
    Replies:
    2
    Views:
    849
  5. Jared
    Replies:
    5
    Views:
    195
    Jared
    Jul 10, 2003
Loading...

Share This Page