Click to See Complete Forum and Search --> : PHP with Javascript


zuzupus
07-01-2003, 03:10 AM
hi,
anybody knows how i can mix PHp with javascript asi dont like to write like this i mean hard coded
document.layers.pendule.document.write("<form name=\"tstest\"><select name=\"bis\" size=\"1\"><option value=\"- - - -\" selected>"+ document.tstest.bis2.value +"</option><option value=\"09:00\">09:00</option><option value=\"10:00\">10:00</option><option value=\"11:00\">11:00</option></select></form>");

i want to use PHP between select but how
<select>
<option value="<?=date('H:i')?>"><? echo (date('H:i')); ?></option>
<? fillDD(0, 0, -1); ?>
</select>

thansk in advance

pyro
07-01-2003, 07:15 AM
When going from PHP to javascript, you can do just that. As PHP is serverside, it will run before the HTML(or javascript) is displayed, so any echos/prints in your PHP code will be displayed in the actual code.

zuzupus
07-01-2003, 07:20 AM
sorry i ddint understood could u plz modify the php code in <select i will be very thnakful to you

pyro
07-01-2003, 07:35 AM
What you had should work fine, if your server supports short tags. If not, try this:

<select>
<option value="<?PHP echo date("H:i");?>"><?PHP echo date("H:i"); ?></option>
<? fillDD(0, 0, -1); ?>
</select>