467,910 Members | 1,524 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,910 developers. It's quick & easy.

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,

Expand|Select|Wrap|Line Numbers
  1. <body>
  2. <?php 
  3. $userid="45367";
  4. echo "<a href='test2.php?userid=$userid'>My plan</a>";
  5. ?>
  6. </body>
  7. </html>
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <?php
  4. $userid = $_GET['userid'];
  5. ?>
  6. <form name="form1" action="test3.php" method="post">
  7. Name : <input type="textbox" name="name">
  8. Age : <input type="textbox" name="age">
  9. Sex : <input type="checkbox" name="sex">
  10. <input type="submit" value="GO">
  11. </form>
  12. </body>
  13. </html>
Please help

WIth regards
Apr 4 '08 #1
  • viewed: 1102
1 Reply
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="fieldvalue" 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
Apr 4 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Perttu Pulkkinen | last post: by
4 posts views Thread by omidmottaghi | last post: by
1 post views Thread by Jason Galvin | last post: by
3 posts views Thread by John Dalberg | last post: by
2 posts views Thread by dougawells | last post: by
11 posts views Thread by shankwheat | last post: by
3 posts views Thread by Sonnich | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.