In php, how does the select command obtain the val value and transmit it to the SQL statement? click the data on the right on the left.
The code is as follows:
Script
Document. getElementById ("sel"). value = "3 ";
Document. getElementById ("sel"). fireEvent ("onchange ");
Function demo ()
{
Var d = document. getElementById ("sel"). value;
Document. getElementById ("tex"). value = d;
Alert (d );
}
Script
Select Foreach (range ('A', 'z') as $ val ){Echo"";Echo $ val;Echo"";}?>
Require_once 'admin/config. php ';
If ($ conn ){
$ Stmt = odbc_exec ($ conn, "select distinct [category] FROM [Website product View] WHERE [category] like 'a % '");
If ($ stmt ){
$ Arr = array ();
While ($ row = odbc_fetch_array ($ stmt )){
$ Arr [] = $ row;
}
For ($ I = 0; $ I {
If ($ I % 4 = 0 ){
Echo"";
}
?>
}
}
}
?>
Reply to discussion (solution)
What is the data received by php?
Print_r ($ _ GET );
Print_r ($ _ POST );
Print_r ($ _ POST );
Execute the command on the original page to pass the alert (d) value to the SQL statement.
If there is no need to change, ajax will be used. the select box value will be passed to php, and php will return json data to js to complete page ING.
Is there an instance!
Receiving data is A-Z
Html implementation:
1 3
PHP:
$ Sel = $ _ POST ['sel '];
In this case, the submit button is still required. It means you can click on the right side of the page.
In this case, the submit button is still required. It means you can click on the right side of the page.
After the form is submitted, the select value can be passed to the server.
Sorry for your question...
In this case, the submit button is still required. It means you can click on the right side of the page.
Ajax. when you click it on the left, the js function is triggered. use ajax to upload the selected value to the server to obtain the corresponding data and put it back to the right.
Override the onchange event processing function. send an ajax request in the function to send the sel value to the server. The result is displayed to the right.
There are many examples of ajax on the Internet.
How does the onchange event send an ajax request in the function to send the sel value to the server. I still don't know about ajax