HELP: Reading javascript var from PHP | | |
I have a simple screen:
1 question, 4 answers (A,B,C,D)
The user clicks on a letter (answer) and it highlights the answer.
(Javascript)
When the use clicks NEXT I want PHP code to run and store the users choice
in a MySql db.
Any idea how to get the users "answer" from PHP?
Thanks! | | | | re: HELP: Reading javascript var from PHP
On Wed, 27 Oct 2004 21:29:41 GMT, Cirene <dont@email.me> wrote:
[color=blue]
> I have a simple screen:
> 1 question,[/color]
Some text.
[color=blue]
> 4 answers (A,B,C,D)[/color]
Four radio buttons.
[color=blue]
> The user clicks on a letter (answer) and it highlights the answer.
> (Javascript)[/color]
Fair enough.
[color=blue]
> When the use clicks NEXT[/color]
A submit button.
[color=blue]
> I want PHP code to run and store the users choice in a MySql db.[/color]
The form is submitted and the server-side code gets the form data.
[color=blue]
> Any idea how to get the users "answer" from PHP?[/color]
Provide a link, or server-side redirect, to a PHP page that reads from the
database.
I'm now a little confused. Your subject suggests that you want PHP to get
the a script value (and I don't see where that fits in so far). The
question immediately above suggests that you want to read from the
database. Which is it?
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail. | | | | re: HELP: Reading javascript var from PHP
Thanks for the response.
From an interactivity standpoint...
1. Page loads and reads the question and the 4 corresponding answers from a
MySql db.
2. User selects their answer and it's highlighted.
3. User clicks next and their answer is written to the database.
Does that help?
"Michael Winter" <M.Winter@blueyonder.co.invalid> wrote in message
news:opsgjto1xax13kvk@atlantis...[color=blue]
> On Wed, 27 Oct 2004 21:29:41 GMT, Cirene <dont@email.me> wrote:
>[color=green]
>> I have a simple screen:
>> 1 question,[/color]
>
> Some text.
>[color=green]
>> 4 answers (A,B,C,D)[/color]
>
> Four radio buttons.
>[color=green]
>> The user clicks on a letter (answer) and it highlights the answer.
>> (Javascript)[/color]
>
> Fair enough.
>[color=green]
>> When the use clicks NEXT[/color]
>
> A submit button.
>[color=green]
>> I want PHP code to run and store the users choice in a MySql db.[/color]
>
> The form is submitted and the server-side code gets the form data.
>[color=green]
>> Any idea how to get the users "answer" from PHP?[/color]
>
> Provide a link, or server-side redirect, to a PHP page that reads from the
> database.
>
> I'm now a little confused. Your subject suggests that you want PHP to get
> the a script value (and I don't see where that fits in so far). The
> question immediately above suggests that you want to read from the
> database. Which is it?
>
> Mike
>
> --
> Michael Winter
> Replace ".invalid" with ".uk" to reply by e-mail.[/color] | | | | re: HELP: Reading javascript var from PHP
Cirene said:[color=blue]
>
>I have a simple screen:
>1 question, 4 answers (A,B,C,D)
>
>The user clicks on a letter (answer) and it highlights the answer.
>(Javascript)
>
>When the use clicks NEXT I want PHP code to run and store the users choice
>in a MySql db.
>
>Any idea how to get the users "answer" from PHP?[/color]
Typically, the client's browser submits a form to a PHP server page
which stores the answer and then presents the next page. | | | | re: HELP: Reading javascript var from PHP
On Wed, 27 Oct 2004 21:52:24 GMT, Cirene <dont@email.me> wrote:
[color=blue]
> From an interactivity standpoint...
> 1. Page loads and reads the question and the 4 corresponding answers
> from a MySql db.
> 2. User selects their answer and it's highlighted.
> 3. User clicks next and their answer is written to the database.[/color]
I described how to do that. The answers are written as radio buttons in a
form, and your "Next" button is that form's submit button. The action of
the form refers to a PHP which reads the submitted value and adds it to
the database.
The specifics are not on-topic in this group. You'd have to ask in either
alt.php or comp.lang.php.
[color=blue]
> Does that help?[/color]
Sort of. It shows I understand what you're trying to do, but not what
you're asking.
I'm sorry, but aside from highlighting the selected answer, this
"question", as written, has nothing to do with Javascript. It's PHP and
basic HTML.
[snip]
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail. |  | Similar JavaScript / Ajax / DHTML bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,449 network members.
|