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.
transfering php variable to html <input...
Moderator: General Moderators
-
grabber_grabbs
- Forum Commoner
- Posts: 60
- Joined: Mon Oct 10, 2011 6:13 pm
Re: transfering php variable to html <input...
Code: Select all
document.writeln('<tr><td>Compte:</td><td><input type="text" name="varacctno" value="' + acctno + '" readonly></td></tr>');
-
grabber_grabbs
- Forum Commoner
- Posts: 60
- Joined: Mon Oct 10, 2011 6:13 pm
Re: transfering php variable to html <input...
Damn, was i happy to see Celauran responding..... i knew my problem were going to be solved. Thanks again...
once again, thanks. Would like to understand why ' + acctno + '
i know somewhere else in my project, i have this and this is working
Echo " <input type=hidden name=\"ID_NUM\" value=\"$prodno\"> ";
once again, thanks. Would like to understand why ' + acctno + '
i know somewhere else in my project, i have this and this is working
Echo " <input type=hidden name=\"ID_NUM\" value=\"$prodno\"> ";
Re: transfering php variable to html <input...
One is PHP, one is JavaScript. Different languages, different syntax. The concatenation operator in PHP is . whereas JavaScript uses +