Making JavaScript and PHP play together

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 23
Joined: Thu Feb 13, 2003 1:58 pm
Location: Peterborough, NH

Mon Jun 09, 2003 7:10 am


This is similar to an earlier post. I have built this nice DHTML tab control. Each tab has a number of fields that are loaded something like:

Code: Select all

<td align="left"><input type=text name="txtFirstName" size=25 maxlength=25 title="Enter first name" tabindex=1 value=<?=$g_TBDispFirstName?>></td>

This is the scenario:
I bring it up and $g_TBDispFirstName is set to something like "Charles" (executed a query to get the values). The user changes the name to "Charlie" then clicks and goes to another tab that executes some JavaScript code then brings up a different set of fields. The user then returns to the tab with the code above. The JavaScript code displays the innerHTML that of course has the original value of "Charles" and not the modified value of "Charlie".

How can I update values between PHP and JavaScript? In this case when they click to go to another tab after modifying the field, I need to modify $g_TBDispFirstName before going to the other tab.

Any help would be appreciated. I am kind of under the gun here.

- Brownie

User avatar
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Mon Jun 09, 2003 8:34 am

if you are xfreing info from page to page I would use sessions to store the value of the name.

when you initiate the name variable you will need to output the info that was in the $_SESSION['name'] var.

Post Reply