select-php How to read the drop-down menu to select data

Source: Internet
Author: User
Keywords Select PHP drop-down menu
selectphp drop-down menu

$con = mysqli_connect($db_hostname,$db_username,$db_password,$db_database);if (!$con) die("Unable to connect to MySQL: ".mysqli_connect_error());$query = "select * from tutorials";$result = mysqli_query($con,$query);$result || die("Database access failed: ".mysqli_error($con));$rows = mysqli_num_rows($result);while ($row = mysqli_fetch_assoc($result)) {    echo "Day: ", $row["day"],"
\n"; echo "Time: ", $row["time1"],"
\n"; echo "Available: ", $row["available2"],"
\n"; echo "Time: ", $row["time2"],"
\n"; echo "Available: ",$row["available"],"

\n";}

?>

Choose a day from above timetable:


Select a day
$query = "Select Day from Tutorials";
$result = Mysqli_query ($con, $query);
$result | | Die ("Database Access failed:". Mysqli_error ($con));
while ($rows = Mysqli_fetch_assoc ($result)) {
?>

Please choose one time:


Select a Time
if (Isset ($_post[' submit '))
$day = $_post[' selectday ');
echo "The day is $day";
$query = "Select time1 from Tutorials where day= ' $day '";
$result = Mysqli_query ($con, $query);
$result | | Die ("Database Access failed:". Mysqli_error ($con));
?>

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.