dannybrazil Posted September 4, 2009 Share Posted September 4, 2009 Hello Im using javascript and cookies to send to another page in my site some variables In the other page i recieve them like that : <script language="JavaScript"> if (widget_array != ""){ for (i=1; i < widget_array.length; i++){ document.write("<h3>" + widget_array[i] + "</h3>"); }//ends diplay FOR }//ends widget display if(ninja_array != ""){ for (i=1; i < ninja_array.length; i++){ document.write("<h3>" + ninja_array[i] + "</h3>"); }//ends FOR }//ends ninja display </script> Now my question is ....(and this is the php - sql question) how can i make the variable the i passed to stay a variable , e.g. variable page 1: id=123 *i entered the number 123 into the cookie variable page 2: now this page will show me ALL the array ( 123...134...156...etc...) but i dont want it to print it on the screen i just want to get variables that i can use php-mysql e.g. $id=123 in order to print the specific data from my data base hope u got it.... Danny Quote Link to comment Share on other sites More sharing options...
YourNameHere Posted September 5, 2009 Share Posted September 5, 2009 use a hidden input and use a document.GetElementById('hidden').value = javascriptVar; (use "hidden" as the inputs name attribute) then use: document.forms('id').submit; to submit it (make sure the forms method="POST") then to access it via the new page is $_POST['hidden'] then do whatever you want with the php var with SQL. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.