AdamBrave Posted January 11, 2013 Share Posted January 11, 2013 Hi, I have one html file where I use the following expression: <select name=selMonth onchange='changeCal()'>"; Then, I have another file, this one is a php file, where I want to use the selected value on the dropdown list select object. I tried to use the following expression in the php file but it didn't worked: var xpto = parseInt(document.calForm.selMonth.value); It presents me nothing... Can someone help me please? Regards, Quote Link to comment https://forums.phpfreaks.com/topic/273020-using-the-same-variable-in-more-than-one-file/ Share on other sites More sharing options...
haku Posted January 12, 2013 Share Posted January 12, 2013 PHP scripts are executed on the server, with the output being sent to the browser. Javascript is then executed on the browser. Sending data to a PHP script on the server is not as straightforward as many would hope, but it can be done, using a process called AJAX which interacts with the server in the background. Can you give more info on what it is you are trying to pass with some concrete examples? This will make it easier to give you suggestions. Quote Link to comment https://forums.phpfreaks.com/topic/273020-using-the-same-variable-in-more-than-one-file/#findComment-1405099 Share on other sites More sharing options...
AdamBrave Posted January 14, 2013 Author Share Posted January 14, 2013 Well the first file it's a calendar. The second file (new.php) is loaded when I click in one of the calendar days. Code: "<td align=center><span id=sp" + aa + " onclick=\"location.href='new.php?asd=" + aa + "'\"></span> </td>"; I want to pass to the second file, beside the chosen day stored in the "asd" variable, the month and the year choosen. On the firs file both month and year are choosen in the dropdown list. Code: text = "<form name=calForm>"; text += "<table border=1>"; text += "<tr><td>"; text += "<table width=1%><tr>"; text += "<td align=center>"; text += "<select name=selMonth onchange='changeCal()'>"; ... text += "<td align=center>"; text += "<select name=selYear onchange='changeCal()'>"; How can I change the code to also pass Year and Month for the new.php file? Quote Link to comment https://forums.phpfreaks.com/topic/273020-using-the-same-variable-in-more-than-one-file/#findComment-1405543 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.