How can I transfer values of two different veriable on a single submit button click to an another page........using javascript & php

Recommended Answers

All 2 Replies

A solution is to store the variable value in a hidden element inside form. For example:
document.getElementById('id').value = id_var;

Then, when the form is submitted the idea it's to create another hidden element using $_POST or $_GET. In javascript, then will be possible to use:
var id_var = document.getElementById('id').value;

I have posted this before, but here it is again:
I have a page that shows job posings and the recordset contains the job title called Position
on my first page I start the session, name the session and give it the value of the recordset like this:

session_start();
$_SESSION= $row_rsposition;


on the next page, I once again start the session and echo it to the screen to test it like so:

session_start();
echo $_SESSION;

you can further assign it to values on the form like this:
(this is a checkbox element)
<input name="Administrative_Support_Assistant" type="checkbox" id="Administrative_Support_Assistant" value="Y" <? if (!$_POST && (!(strcmp($_SESSION, "Administrative Support Assistant")))) { echo "checked=\"checked\"";} ?>/>

for a text box use something like this:
<input name="Position" type="text" id="Position" value=" <? echo $_SESSION;?>"


hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.