disabling the form elements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gubbachchi
    New Member
    • Jan 2008
    • 59

    #1

    disabling the form elements

    Hi all,

    I have an issue here.
    There is a link "My plan" in the php page1. On clicking this link directs to a form which has some entries that has to be filled by the user.And once the user fills the form and clicks the submit button the entries will be stored in the database.

    What I need is, when the user fills the form and submits the form once all the form elements should be disabled. If the user again clicks the "My plan" link, the form elements should be disabled. I know that this can be done by recognizing the user_id, since this will be unique. But how exactly can I do this. Here is the code I am using,

    test1.php
    Code:
    <body>
    <?php 
    $userid="45367";
    echo "<a href='test2.php?userid=$userid'>My plan</a>";
    ?>
    </body>
    </html>
    test2.php
    Code:
    <html>
    <body>
    <?php
    $userid = $_GET['userid'];
    ?>
    <form name="form1" action="test3.php" method="post">
    Name : <input type="textbox" name="name">
    Age : <input type="textbox" name="age">
    Sex : <input type="checkbox" name="sex">
    <input type="submit" value="GO">
    </form>
    </body>
    </html>
    Please help

    WIth regards
  • coolsti
    Contributor
    • Mar 2008
    • 310

    #2
    It is not really clear to me what you want to do here. Your test2.php is going to invoke the script test3.php and your user will then see whatever test3.php sends back to the browser as a response. If you want to echo the values that the user has inputted with test2.php, you can do it simply using other kinds of html tags rather than input tags. Or you could show them as the exact same input tags, but specify in the response of test3.php that these inputs are disabled, by adding the "disabled" keyword:

    <input type="text" name="fieldname " value="fieldval ue" disabled />

    You also might want test2.php to actually invoke test2.php again, with scripting to either show the input fields again to the user in the event the user did not enter something correctly, or if the fields were entered correctly, to perform the next step and show the user whatever test3.php would have shown.

    Steve, Denmark

    Comment

    Working...