Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

pdo inside a html drop down

PHP Code

<?php
                                                
                                                
$query9 
= $db->prepare('SELECT * FROM categories WHERE takeawayid= ? ');
 
$query9->execute(array($_SESSION['id']));
    
// alternatively you could use PDOStatement::fetchAll() and get rid of the loop
    // this is dependent upon the design of your app
    
foreach ($query9 as $row9) {
                                                
                                                
?>
 <select name="country" class="form-control form-select form-select-lg select2" data-bs-placeholder="Select Country">
 <option value="<?php echo $row9['cat_id']; ?>"name = "topic_cat"id="topic_cat" ><?php echo $row9['cat_name']; ?></option>
    </select>                                        
<?php } ?>
                                              
                                      
                                    </div>
                                              
                                              
                                        <input type="submit"   class="btn btn-success my-1">
                                              
                                      </form> 


Im off course opening the form higher up and its outputting all the results into the drop down but when i submit the post the form is empty ?








Found the issue i called the select country higher up all fixed now


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Javascript]  by flexing_99Apr 29, 2023 12:02 AM 3 268 Apr 29, 2023 12:02 AM
Last Post: Zgh600
[PHP] by GeatzoMar 6, 2023 12:28 PM 4 253 Mar 6, 2023 12:28 PM
Last Post: Horus Strike
[PHP] by GeatzoMar 4, 2023 05:34 PM 0 104 Mar 4, 2023 05:34 PM
Last Post: Geatzo