Jump to content

PHP listbox help


frozenlight777

Recommended Posts

I'm fairly new to PHP and was wondering how to generate a calender from a list box when it's clicked.

for example i have the following code...

 

<form name="form1" method="post" action="">

<span> Search By: </span>

<select size=1 name=list>

<option value="fname">First Name</option>

<option value="lname">Last Name</option>

<option value="drange">Date Range</option>

</select>

  <span class="style4">Enter Name</span>

  <input name="q" type="text" id="q" value="<?php echo $q; ?>">

  <input type="submit" name="Submit" value="Look Up Hours">

</form>

 

I want to make a calender or two appear when the "Date Range" item is clicked in the list box. Not quite sure how.

Link to comment
https://forums.phpfreaks.com/topic/85031-php-listbox-help/
Share on other sites

the javascript would be something like this:

 

in the form, where you have the <select name="listbox" ... > add "onchange = checkListBox();"

 

something like this:

<select name="myListBox" id="myListBox" onchange = checkListBox(); >

 

then you can have this function either on the web page or in a linked .js file:

 

function checkListBox {
   if(document.getElementById("myListBox").value = "3rd item") {
   //make text box visible or just add text to an empty <span> or <p> using innerHTML
   }
}

 

 

you should look up the how the listbox works and how JS might interact with them, this example might not be coded totally correctly. I hope this helps, though.

Link to comment
https://forums.phpfreaks.com/topic/85031-php-listbox-help/#findComment-433836
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.