dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Display data dynamically based on dropdown menu selection

  1. #1
    Join Date
    Mar 2013
    Posts
    2

    Smile Display data dynamically based on dropdown menu selection

    Hey, need help from some php Ninja's.

    I have some members details set-up in a database where a plugin has done the easy part and created a table and id for members. I now need to insert a drop down menu on each members page which will dynamically display their price based on the selected location. So the member id as well as location field/values will need to be taken into consideration.

    Thanks in advance.

  2. #2
    Join Date
    Mar 2013
    Posts
    2

    How do i select which column names are displayed?

    So I figured out how to display the column names from the table with

    <?php
    $dbhost = 'localhost';
    $dbname ='database';
    $dbuser = 'root';
    $dbpass = 'pass';


    mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
    mysql_select_db($dbname) or die(mysql_error());

    ?>


    <select name="selectname">

    <?php
    $result = mysql_query("SHOW COLUMNS FROM my_database")
    or die(mysql_error());

    while($nt=mysql_fetch_row($result)){
    echo "<option value=" . $nt[0] . ">" . $nt[0] . "</option>";
    }

    ?>

    </select>

    How do I select only specific columns, as I only want the ones with location names?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles