I have created a form in html with dropdown list box with static values inside a php file, now i need to populate those dropdown with data from mysql database. i have written a function in php to retrive data from the mysql table. since i am new to php i don't know how to call a php function from html. is it possible to call a php function like calling a JavaScript function.
Here is my HTMl code.
<div id="machinelog">
<form id="intermediate" name="inputMachine" method="post">
<select id="selectDuration" name="selectDuration">
<option value="1 WEEK" >Last 1 Week</option>
<option value="2 WEEK" >Last 2 Week </option>
<option value="3 WEEK" >Last 3 Week</option>
</select>
<select id="selectMachine" name="selectMachine">
<option value="M1" >Machine 1</option>
<option value="M2" >Machine 2</option>
<option value="M3" >Machine 3</option>
</select>
<input id="Button" class="button" type="submit" value="Submit" />
</form>
</div>
I need to take all machine names form mysql and populate the "selectMachine" drop down list box.
My php function is
function selectMachine()
{
$strQuery = "select id, machine
from rpt_machine
order by machine";
$machineResult = mysql_query($strQuery);
while($arrayRow = mysql_fetch_assoc($machineResult)) {
$strA = $arrayRow["id"];
$strB = $arrayRow["machine"];
}