View Full Version : drop down menu help.

08-06-2002, 05:26 PM
I have a drop down menu and I was wondering if it was possible when someone submited my form it would delete something from the drop down menu.

08-06-2002, 05:41 PM
Um...you want it to delete one of the options AFTER the form submission? Doesn't that defeat the purpose? Not that I don't believe you have a reason, but what are you trying to do?

08-06-2002, 05:43 PM
its a online rpg and I dont want everyone to choose the same character.

08-06-2002, 05:46 PM
Oh, so that when the next person visits, they can't select that option?

Sorry, but you cannot do this with javascript. You need a server-side language, such as PHP

Note: The option CAN be removed after submit, but it won't make a difference, because it will only affect the current user (i.e. it is removed from the run-time HTML) The next visitor will see the page with no changes.

08-06-2002, 11:05 PM
actually u can, using cookies if cookie is there then take out option *read from cookie*....

08-06-2002, 11:10 PM
Yes, but that would only work if you assume that all the users are accessing the page from the same client machine (pretty unlikely, dont ya think?). A cookie on my computer will do nothing to affect a page when YOU view it.

Oh, and I'd like to append a previous statment of mine. Javascript can be used server-side, but it has it's own set of variables/methods etc and is largely different from the client-side javascript most of us use. Besides, hardly anyone would recommend serverside javascript over PHP or Perl or something like that....

08-06-2002, 11:19 PM
i don't know what u are talking about...

cookies are saved onto a person's machine when they access a page, then the javascript will read that cookie when u visit again.... right?

08-06-2002, 11:42 PM
Originally posted by -sephiroth-
its a online rpg and I dont want everyone to choose the same character. I'm assuming that he is making a form or something that his friends can use to create characters. If this is an online webpage, then cookies will do him no good. If they all meet at his house or at one machine, then it would work.

Lets say I visit this page and select a character. The page uses javascript to remove that option from the SELECT object, and saves a cookie to my machine with that info. If I re-visit the page, then that option will no longer exist (because the cookie said so :D) Now, lets say that you visit the SAME page from YOUR computer for the first time. You will see all the orignal options in the SELECT object because the cookie on MY computer has ZERO effect on yours.

So, essentially, if we relied on cookies to solve this problem, both you and I could select the same character, which means cookies really didn't solve it at all. Savvy?