Re: javascript to php ???????
| From: | Mark | Date: | Tue, 13 Nov 2001 23:24:36 +0000 |
| Subject: | Re: javascript to php ??????? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-74504@lists.php.net to get a copy of this message | ||
On Tue, 13 Nov 2001 20:17:32 -0300, fitiux wrote:
> >>Hi =)
>>>is it possible to pass a javascript array to php ???
>
>>by the time javascript comes into play, php has already done it's
>>job
>>and left the building. If you mean can javascript pass variables
>>to a
>>new request for php to handle, then sure.
>
>
>Thanks for your reply. =)
>
>I have a little problem..
>well.. with php I build an html page with javascript to validate a
>form,
>the action of this form is call again to the php page.
>I mean...
> test.php ----- (make an html page)---> question.html ---
>(submit form)----> test.php
>
>I populated an array but now I need to pass this array to the same
>starting php page again.
>
>can I do this?
sure. for GET you would just make a request out of the variables,
i.e.:
var url="/mypage.php?value[0]="+value[0]+"value[1]="+value[1];
document.location.href=url;
you can do this in a loop if you want. for POST you would use hidden
fields, i.e.:
document.write('<input type=hidden name=value[0]
value='+value[0]+'>');
document.write('<input type=hidden name=value[1]
value='+value[1]+'>');
you could do this in a loop too.