The obtained checkbox value does not know where it comes from? I obtained the result from the database and used the roomname field as the value of the checkbox. how can I add the result in the summitdata function of the javascript script and the data obtained in mcustom. php? 1. echo & quot; & lt; the checkbox value obtained by formactionqtj does not know where the checkbox value comes from /?
I obtained the result from the database and used the roomname field as the value of the checkbox. how can I add the result to the data obtained in the summitdata function of the javascript script and mcustom. php /?
1.
Echo "";
2. javascript section
Function checkchecked (checkboxs)
{
For (var I = 0; I
{
If (checkboxs [I]. checked)
{
Alert (checkboxs [I]. value); // The value of checkboxs [I]. value obtained here is 101/, which has been added/
Return true;
}
}
Alert ("Please select the room .");
Return false;
}
Function submitdata ()
{
Var checkboxs = document. getElementsByName ("selectrooms []");
Var checked = checkchecked (checkboxs );
If (checked)
{
Var form = document. getElementById ("roomlist ");
Form. submit ();
}
Else
{
Return false;
}
}
3. obtained in mcustom. php
If (isset ($ _ GET ["selectrooms"])
{
$ Selectrooms = $ _ GET ["selectrooms"];
Foreach ($ selectrooms as $ item)
{
Echo"";
Echo"". $ Item .""; // Here also has/
Echo"";
}
}
------ Solution --------------------
Value = ". $ row ['roomname']."/>"; The result is probably value = roomnamevalue/>
There is no space between value and/>, so the browser considers value = roomnamevalue /. We recommend that you add "" to any attribute to include the attribute value.