How do I transmit javascript-generated values to PHP? My page is a PHP page. I use javascript to implement the onchange () event in the drop-down list. how can I send the new value of the list to the php code. I tried to use cookies, but only the first value can be passed each time. for example, if userid0 is selected for the first time, php can get it. but when userid1 is selected again, how does php transmit the javascript value to PHP?
My page is a PHP page. I use javascript to implement the onchange () event in the drop-down list. how can I send the new value of the list to the php code.
I tried to use cookies, but only the first value can be passed each time. for example:
If userid0 is selected for the first time, php can obtain the value. if userid1 is selected again, php still obtains the value for the first time.
How can this problem be solved?
SetCookie ("userID", current_user_id );
Alert (document. cookie );
$ File_exist = 0;
$ Imagefile = 'user'. $ userID. ". jpg ";
If (file_exists ($ imagefile ))
$ File_exist = 1;
?>
Alert (" ");
------ Solution --------------------
AJAX can be implemented
------ Solution --------------------
PHP code
// Index. php
12
------ Solution --------------------
It can be submitted to the php page, or implemented using ajax. of course, it can still be implemented using cookies.
Paste some of your code to see it.
------ Solution --------------------
Store the value with the session, and then assign the session value to php.
------ Solution --------------------
Upstairs positive solution
------ Solution --------------------
The 4th floor is correct and simple. of course AJAX can be used
------ Solution --------------------
Simple session storage