www.webdeveloper.com
Results 1 to 4 of 4

Thread: PHP with Javascript

  1. #1
    Join Date
    Jun 2003
    Posts
    181

    PHP with Javascript

    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

  2. #2
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    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.

  3. #3
    Join Date
    Jun 2003
    Posts
    181
    sorry i ddint understood could u plz modify the php code in <select i will be very thnakful to you

  4. #4
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    What you had should work fine, if your server supports short tags. If not, try this:

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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles