OK, I won't post my code right away but instead I'll start with a scenario and a question.
Let's say I have a standard link on my page:
Here's what I'd like to happen... the user clicks on the link. They're prompted with a dialog box. They fill out the info (one word) and then the page that loads checks that word against a stored value.
My initial thought was that the new page would have a javascript in it that would pop up a prompt box for the user. The user inputs the word and the page checks that against the stored value.
I tinkered with that for a while, but I'm pretty sure I'm running into an issue of client-size (javascript) and server-side (php). The purpose of the javascript is to get the variable from the user and the php is to check the variable and process the rest of the page (php/mysql interaction, etc). The problem arises because the javascript is getting the variable after the php has already executed (therefore returning a false value all the time).
(side note: I found some code online to transfer a variable from javascript to php and that part works.)
Is it possible to reload the page with a specific URL? Perhaps the user inputs the variable in the javascript popup, then the page reloads with the variable in the link, so the php can now process it. Something like:
http://www.site.com/blah.php?foo=variable (with ?foo=variable added via the script?)
Man, this is confusing as crap. If anyone can make any sense out of this, I'll be amazed.
Let's say I have a standard link on my page:
Code:
<a href="http://www.site.com/blah.php">link</a>
Here's what I'd like to happen... the user clicks on the link. They're prompted with a dialog box. They fill out the info (one word) and then the page that loads checks that word against a stored value.
My initial thought was that the new page would have a javascript in it that would pop up a prompt box for the user. The user inputs the word and the page checks that against the stored value.
I tinkered with that for a while, but I'm pretty sure I'm running into an issue of client-size (javascript) and server-side (php). The purpose of the javascript is to get the variable from the user and the php is to check the variable and process the rest of the page (php/mysql interaction, etc). The problem arises because the javascript is getting the variable after the php has already executed (therefore returning a false value all the time).
(side note: I found some code online to transfer a variable from javascript to php and that part works.)
Is it possible to reload the page with a specific URL? Perhaps the user inputs the variable in the javascript popup, then the page reloads with the variable in the link, so the php can now process it. Something like:
http://www.site.com/blah.php?foo=variable (with ?foo=variable added via the script?)
Man, this is confusing as crap. If anyone can make any sense out of this, I'll be amazed.