Problem when submit

Discussion in 'HTML' started by goliathuy, Jul 11, 2006.

  1. goliathuy

    goliathuy Guest

    HI.. i need some help, i'm working on a form and using the submit
    button value to know when it has been submited... but the problem is
    that when i press <enter> on the text field, the value do not come...
    any clues?
    Here is the fom code:
    <form name="searchForm" action="search.php" method="post"
    enctype="multipart/form-data">
    <table width="1%" border=0>
    <tr title="User name">
    <tr>
    <td></td>
    <td rowspan="5">
    &nbsp;<INPUT type="hidden" name="Op" id="Op"
    value="p"/>
    </td>
    <td></td>
    </tr>
    <td align="left">
    <label class="texto">User&nbsp;name:</label>
    </td>
    <td width="1%">
    <input type="text" id="usrName" name="usrName"
    tabindex="002" size="30" maxlength="60">
    </td>
    </tr>
    <tr>
    <td colspan="3" valign="middle" align="right">
    <input type="submit" name="sent" id="sent"
    tabindex="101"
    value="Search" title="Search..."
    class="submitBlue"/>
    </td>
    </tr>
    </table>
    </form>
     
    goliathuy, Jul 11, 2006
    #1
    1. Advertising

  2. goliathuy

    Guest

    You need to set the default value of each input box to the the $_POST
    value that was submitted.

    You have...

    > <input type="text" id="usrName" name="usrName"
    > tabindex="002" size="30" maxlength="60">




    What you need is

    <input type="text" id="usrName" name="usrName"
    tabindex="002" size="30" maxlength="60" value =
    $_POST[usrName]>

    REMEMBER!!!!

    When outputting text via PHP's Print command, only variables contained
    in double quotes will be converted to their values.

    So if your PHP code looks like this....

    Print '<input type="text" id="usrName" name="usrName" tabindex="002"
    size="30" maxlength="60" value = $_POST[usrName]>';

    The default value will show as "$_POST[usrName]" rather than the value
    of $_POST[usrName].

    Either swap the quotes over:
    Print "<input type='text' id='usrName' name='usrName' tabindex='002'
    size='30' maxlength='60' value = $_POST[usrName]>";

    or force the quotes with the escape character

    Print "<input type=\"text\" id=\"usrName\" name=\"usrName\"
    tabindex=\"002\" size=\"30\" maxlength=\"60\" value =
    $_POST[usrName]>";

    or drop them altogether

    Print '<input type=text id=usrName name=usrName tabindex=002 size=30
    maxlength=60 value = $_POST[usrName]>';

    You only really need them if your values have spaces in them (an to be
    WCC compliant of course...)




    goliathuy wrote:
    > HI.. i need some help, i'm working on a form and using the submit
    > button value to know when it has been submited... but the problem is
    > that when i press <enter> on the text field, the value do not come...
    > any clues?
    > Here is the fom code:
    > <form name="searchForm" action="search.php" method="post"
    > enctype="multipart/form-data">
    > <table width="1%" border=0>
    > <tr title="User name">
    > <tr>
    > <td></td>
    > <td rowspan="5">
    > &nbsp;<INPUT type="hidden" name="Op" id="Op"
    > value="p"/>
    > </td>
    > <td></td>
    > </tr>
    > <td align="left">
    > <label class="texto">User&nbsp;name:</label>
    > </td>
    > <td width="1%">
    > <input type="text" id="usrName" name="usrName"
    > tabindex="002" size="30" maxlength="60">
    > </td>
    > </tr>
    > <tr>
    > <td colspan="3" valign="middle" align="right">
    > <input type="submit" name="sent" id="sent"
    > tabindex="101"
    > value="Search" title="Search..."
    > class="submitBlue"/>
    > </td>
    > </tr>
    > </table>
    > </form>
     
    , Jul 12, 2006
    #2
    1. Advertising

  3. goliathuy

    goliathuy Guest

    Thanks aaron for your answer.
    The issue isn't the value beeing printed on the output, i'm cheking the
    page source to know if it's geting printed ok.
    Now what this is realy about, is with the HTML code and IE; the same
    page when submited from seamonkey or firefox DO send the "sent" value
    on the $_POST, now when it's time for the browser that the 80% (90%
    70% or whatever is the usage today) of the people use, if i have only
    one <input type"text"....>, the "sent" value (that is an <input
    type="submit"...>) so not come, my solution for this was to add an
    <input type"text" style="display:none"> on the form and now i get my
    values... if any one else has had the same problem please tell me.
    wrote:
    > You need to set the default value of each input box to the the $_POST
    > value that was submitted.
    >
    > You have...
    >
    > > <input type="text" id="usrName" name="usrName"
    > > tabindex="002" size="30" maxlength="60">

    >
    >
    >
    > What you need is
    >
    > <input type="text" id="usrName" name="usrName"
    > tabindex="002" size="30" maxlength="60" value =
    > $_POST[usrName]>
    >
    > REMEMBER!!!!
    >
    > When outputting text via PHP's Print command, only variables contained
    > in double quotes will be converted to their values.
    >
    > So if your PHP code looks like this....
    >
    > Print '<input type="text" id="usrName" name="usrName" tabindex="002"
    > size="30" maxlength="60" value = $_POST[usrName]>';
    >
    > The default value will show as "$_POST[usrName]" rather than the value
    > of $_POST[usrName].
    >
    > Either swap the quotes over:
    > Print "<input type='text' id='usrName' name='usrName' tabindex='002'
    > size='30' maxlength='60' value = $_POST[usrName]>";
    >
    > or force the quotes with the escape character
    >
    > Print "<input type=\"text\" id=\"usrName\" name=\"usrName\"
    > tabindex=\"002\" size=\"30\" maxlength=\"60\" value =
    > $_POST[usrName]>";
    >
    > or drop them altogether
    >
    > Print '<input type=text id=usrName name=usrName tabindex=002 size=30
    > maxlength=60 value = $_POST[usrName]>';
    >
    > You only really need them if your values have spaces in them (an to be
    > WCC compliant of course...)
    >
    >
    >
    >
    > goliathuy wrote:
    > > HI.. i need some help, i'm working on a form and using the submit
    > > button value to know when it has been submited... but the problem is
    > > that when i press <enter> on the text field, the value do not come...
    > > any clues?
    > > Here is the fom code:
    > > <form name="searchForm" action="search.php" method="post"
    > > enctype="multipart/form-data">
    > > <table width="1%" border=0>
    > > <tr title="User name">
    > > <tr>
    > > <td></td>
    > > <td rowspan="5">
    > > &nbsp;<INPUT type="hidden" name="Op" id="Op"
    > > value="p"/>
    > > </td>
    > > <td></td>
    > > </tr>
    > > <td align="left">
    > > <label class="texto">User&nbsp;name:</label>
    > > </td>
    > > <td width="1%">
    > > <input type="text" id="usrName" name="usrName"
    > > tabindex="002" size="30" maxlength="60">
    > > </td>
    > > </tr>
    > > <tr>
    > > <td colspan="3" valign="middle" align="right">
    > > <input type="submit" name="sent" id="sent"
    > > tabindex="101"
    > > value="Search" title="Search..."
    > > class="submitBlue"/>
    > > </td>
    > > </tr>
    > > </table>
    > > </form>
     
    goliathuy, Jul 19, 2006
    #3
    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. Mark
    Replies:
    1
    Views:
    1,800
  2. Ghafran Abbas
    Replies:
    0
    Views:
    4,316
    Ghafran Abbas
    Oct 12, 2004
  3. The Crow
    Replies:
    2
    Views:
    4,464
    Bruce Barker
    Sep 27, 2005
  4. Megha Vishwanath
    Replies:
    2
    Views:
    9,945
    tutorialsmaster
    Oct 2, 2009
  5. Joop
    Replies:
    5
    Views:
    635
Loading...

Share This Page