File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ $ HTMLPage = <<<HTML
4+ **//INSERT HERE THE HTML CODE YOU ONLY WANT TO SHOW IF THE DROPDOWN MENU HAS BEEN CORRECTLY INSERTED:**
5+ <input type="submit" name="submit" value="Submit Form."/>
6+ <input type="reset" value="Reset Form" />
7+
8+ HTML ;
9+
10+ if ($ myDBObject = new mysqli ("**SERVER_HOSTNAME** " ,"**MySQL_USERNAME** " ,"**MySQL_PASSWORD** " )){
11+
12+ $ myDBObject ->select_db ("DB_NAME " );
13+
14+ if (!$ queryResult = $ myDBObject ->query ("SHOW COLUMNS FROM **tableName** WHERE Field= \"**columnName** \"" )){
15+ echo "<h2>There was an error while creating the page.</h2> " ;
16+ }else {
17+ if ($ queryResult ->num_rows == 0 ){
18+ echo "<h2>Check the table definition. " ;
19+ }else {
20+ echo "<hr><br><h2>**Title**:</h2> " ;
21+ $ enumString = $ queryResult ->fetch_array ()['Type ' ];
22+ $ enumString = substr ($ enumString ,6 ,strlen ($ enumString )-8 );
23+
24+ $ enumString = str_replace ('\'' ,'' ,$ enumString );
25+ $ arrayEnumOptions = explode (', ' ,$ enumString );
26+ echo "<select name= \"**select_input_name** \" required> " ;
27+ foreach ($ arrayEnumOptions as $ singleOption ){
28+ echo "<option value= \"$ singleOption \"> $ singleOption</option> " ;
29+ }
30+ echo "</select> " ;
31+ echo $ HTMLPage ;
32+ }
33+ }
34+
35+ }else {
36+ echo "<h2>There was an error while creating the page.</h2> " ;
37+ }
38+ ?>
You can’t perform that action at this time.
0 commit comments