Copy code The code is as follows:<html> <body> <?php // Get the select value $select_value = isset($_GET['select']) ? $_GET['select'] : ''; ?> <form action="?"> <select name="select"> <option value="">default</option> <option value="option1" <?php // If the value obtained above is the same as the value in this option, // Print selected, making this option selected by default echo $select_value == 'option1' ? 'selected' : '' ?>>option1</option> </select> <input type="submit" value="submit" /> </form> </body> </html> This script should be added to each option, and if there are multiple options, they can be printed in a loop. |
<<: Solution to css3 transform transition jitter problem
>>: Implementing a simple age calculator based on HTML+JS
Create a folder Directory structure: dabaots Init...
Recently I saw a barrage effect on B station call...
Preface: Integer is one of the most commonly used...
Project scenario: There is a <ul> tag on th...
Table of contents 1. Anonymous slots 2. Named slo...
This article example shares the specific code of ...
Without further ado, let me give you the code. Th...
Table of contents The background is: What will ha...
This should be something that many people have do...
Overview of MySQL Partitioned Tables As MySQL bec...
This article example shares the specific code of ...
The img tag introduces the image Because react ac...
Good HTML code is the foundation of a beautiful w...
1. Introduction to DockerUI DockerUI is based on ...
Preface: After the automation is written, it need...