Jump to content

Using the same variable in more than one file


AdamBrave

Recommended Posts

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,

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.

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.