I want to change the select box on the cart screen to a text box.

Asked 5 months ago, Updated 5 months ago, 13 views

It's like this now, but

$body.='<select name="number" id="";
// Onchange function is performed when combo box contents are changed
$body.=$row["ID"].'onchange="changeNumber(this);">';
// Convert quantities to numbers
$qty=(int)$row["quantity"];

for($number=0;$number<=10;$number++){
    $body.='<option';

    if($number==$qty){
        $body.='selected value=''.$number.'>'.$number.'</option>';
    } else{
        $body.='value=''.$number.'>'.$number.'</option>';
    }
}

$body.='</select>';

I don't know input type="text" name=number value="?"...

Enter a description of the image here

php html

2022-09-30 11:35

1 Answers

"By the way, I think HTML often calls it ""select box"" instead of combo box."

For the existing code, <select> allows you to select a choice, but if you want it to be entered arbitrarily in a text box, you can print the following HTML:

<input type="text" name="number">

The value entered in the displayed HTML is sent as value, so when you output HTML,
<input type="text" value="..."> is not required.


2022-09-30 11:35

If you have any answers or tips


© 2023 OneMinuteCode. All rights reserved.