0

I have a page which has a form table. It displays select option when an option is selected the user clicks button and it runs choosecake.php which has query for updating. I need the select to be dynamically updated and display the success/error message like "updated" or "no results" on the screen how can I achieve this. Im not very good at ajax could someone guide me please.

displaytable.php

<form method="POST" action="choosecake.php">
    <select id="bakeryid" name="bakeryid">
        <option value="">Select</option>
        <?php
            $sql = "SELECT bakeryid, datefrom FROM cakes";
            $sqlresult = $link->query($sql);
            $sqllist = array();
            if(mysqli_num_rows($sqlresult) > 0) {
                while($row = mysqli_fetch_array($sqlresult))
                {
                echo "<option value=".$row['bakeryid'].">".$row['datefrom']."</option>";
                }
                $sqlencode = json_encode($sqllist);
                echo $sqlencode;
            } else {
                echo 'No Results were found';
            }
        ?>
    </select>
    <input type="hidden" value="<?php echo $bakeryid;?>" name="bakeryid"/>
    <input type="submit" value="Submit" name="submit"/>
</form>

Edited by euhiduwehfui

2
Contributors
2
Replies
23
Views
2 Years
Discussion Span
Last Post by euhiduwehfui
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.