Results 1 to 7 of 7

Thread: submit button wont post

  1. #1

    Thread Starter
    Lively Member DJ P@CkMaN's Avatar
    Join Date
    Jan 2002
    Location
    Burpengary, Queensland, Australia
    Posts
    95

    submit button wont post

    hey all,

    as some of you may know, i have been having a ot of difficulties getting a form to work. i have now found the problem. the $HTTP_POST_VARS wont recognise that the submit button has a value. the following WONT work.

    PHP Code:
    <?
        if(isset($HTTP_POST_VARS['submit'])) {
            mail('[email protected]',$_REQUEST['subject'],$_REQUEST['message'] . '\n\nFrom,\n' . $_REQUEST['from_name'],'From: ' . $_REQUEST['from_email']);
            echo "<b><center>Mail sent!</center></b><br>\n<a href=\"index.php\">Return to home</a><br>\n";
        } else {
            ?>
            <center><b>Email |DJ| P@CkMaN</b></center>
            <form method="post" action="contact.php?action=webmaster">
            Your name: <input type="text" name="from_name" size="35"><br>
            Your email: <input type="text" name="from_email" size="35"><br>
            Subject: <input type="text" name="subject" size="39"><br>
            Message:<br>
            <textarea rows="15" cols="38" name="message"></textarea><br>
            <input type="image" src="../images/buttons/submit.gif" value="Submit" alt="Submit!" name="submit">
            <?
        }
    ?>
    but if i check that the user typed something in message like this script
    PHP Code:
    <?
        if(isset($HTTP_POST_VARS['message'])) {
            mail('[email protected]',$_REQUEST['subject'],$_REQUEST['message'] . '\n\nFrom,\n' . $_REQUEST['from_name'],'From: ' . $_REQUEST['from_email']);
            echo "<b><center>Mail sent!</center></b><br>\n<a href=\"index.php\">Return to home</a><br>\n";
        } else {
            ?>
            <center><b>Email |DJ| P@CkMaN</b></center>
            <form method="post" action="contact.php?action=webmaster">
            Your name: <input type="text" name="from_name" size="35"><br>
            Your email: <input type="text" name="from_email" size="35"><br>
            Subject: <input type="text" name="subject" size="39"><br>
            Message:<br>
            <textarea rows="15" cols="38" name="message"></textarea><br>
            <input type="image" src="../images/buttons/submit.gif" value="Submit" alt="Submit!" name="submit">
            <?
        }
    ?>
    it all works great??

    could someone please tell me whats going on and if theres a way that i can make it work with $HTTP_POST_VARS['submit']??

    thanks heaps
    There's something I've noticed in the last year or so...
    Australian's are good at EVERYTHING !!!

  2. #2
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    try adding onclick="document.submit();"

    to the image submit button.

    <input type="image" src="../images/buttons/submit.gif" alt="Submit!" name="submit" onclick="document.submit();">

  3. #3
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734
    cant $REQUEST be used instead of $HTTP_POST_VARS

  4. #4
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    yes, so can $_POST

  5. #5
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734
    I think I found the problem, it does not seem to work when the submit button is an image

    edit: I am sleepy and wrote a stupid answer

  6. #6
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734
    Ok I am in a daze, phpman you already figured it out, but the thing you wrote does not work for me.

  7. #7
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    try it a couple of ways.

    <input type="image" src="../images/buttons/submit.gif" alt="Submit!" name="submit" onclick="submit();">


    <input type="image" src="../images/buttons/submit.gif" alt="Submit!" name="submit" onclick="this.document.submit();">

Posting Permissions

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



Click Here to Expand Forum to Full Width