transfering php variable to html <input...
Posted: Mon Nov 07, 2011 7:59 pm
Hi there, i did all kind of tests here to find an answer to my problem...without success. Its a chance we all have this site to get support. thanks to you all.
Ok here is the code.
<?php
session_start();
$acctno = $_SESSION['username'];
// to transfer php variable to client side.
echo "<script language=\"javascript\" type=\"text/javascript\">
acctno = \"$acctno\";
// here a test to see if the value is transfered
alert (acctno); // the results is showing that the acctno is transfered ok.
</script>";
..
..
..// several lines of code here.
..
alert( acctno ); // here is the alert command to see if i still have a value in the variable... the results is positive.
// now here is the problem. i cannot have the results of acctno in the input field below.. (note that this field is readonly)
document.writeln('<tr><td>Compte:</td><td><input type="text" name="varacctno" value= acctno readonly></td></tr>');
the results i have is Compte : acctno
what i want is Compte : 42345
I tried with acctno between brackets, without brackets, or like this, $acctno and no positive results... i allways have the variable name into the input field.... what i want is the data inside the variable....
Sorry for my poor english.
Ok here is the code.
<?php
session_start();
$acctno = $_SESSION['username'];
// to transfer php variable to client side.
echo "<script language=\"javascript\" type=\"text/javascript\">
acctno = \"$acctno\";
// here a test to see if the value is transfered
alert (acctno); // the results is showing that the acctno is transfered ok.
</script>";
..
..
..// several lines of code here.
..
alert( acctno ); // here is the alert command to see if i still have a value in the variable... the results is positive.
// now here is the problem. i cannot have the results of acctno in the input field below.. (note that this field is readonly)
document.writeln('<tr><td>Compte:</td><td><input type="text" name="varacctno" value= acctno readonly></td></tr>');
the results i have is Compte : acctno
what i want is Compte : 42345
I tried with acctno between brackets, without brackets, or like this, $acctno and no positive results... i allways have the variable name into the input field.... what i want is the data inside the variable....
Sorry for my poor english.