Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

PHP view only selected records using OBDC with Access DB

PHP view only selected records using OBDC with Access DB

PHP view only selected records using OBDC with Access DB

All - Usually I use mysql databases, but i'm doing a special assignment in which i have to use an Access database using an odbc connection.

My Goal:
-have a select menu with options populated from the database
-when an option is selected, view only selected records
-have all of this on one page

This is what I have so far.
Select Menu (php include that is not included yet)


<p><form action="trainsymbols.php" method="post" id="selectForm">        
        <label>By LSize:</label>
            <select name="id" multiple="multiple" id="multipleSelect">
                <option selected value="">Any LSize</option>
                if (!$conn)
                  {exit("Connection Failed: " . $conn);}
                //call data to be viewed
                $sql = "SELECT * FROM tbl4combo_symbols ORDER BY LSize ASC";
                $rs = odbc_exec($conn, $sql);
                if (!$rs)
                  {exit("Error in SQL");}
                while (odbc_fetch_row($rs))
                  $id = odbc_result($rs,"ID");
                  $LSize = odbc_result($rs,"LSize");
                  echo "<option value='$id'>$LSize</option>\n";
            </select><br />
        <p><input type="submit" id="submitbutton130" class="button positive" value="Search" /></p>

Display page


<table id="SortTable" class="tablesorter">
                    <!--<th class="w70">ID</th>-->
                    <th class="w325">4combo</th>
                    <th class="w70">LSymbol</th>
                    <th class="w70">ESymbol</th>
                    <th class="w70">LSize</th>
                    <th class="w70">ESize</th>
                    <th class="w70" colspan="2">Action</th>
        // create database connection
        if (!$conn)
          {exit("Connection Failed: " . $conn);}
        // call data to be viewed
        $sql="SELECT * FROM tbl4combo_symbols ORDER BY '4combo' ASC";
        // submit the query
        // if query is invalid do this
        if (!$rs)
          {exit("Error in SQL");}
        // if query is valid do this
        while (odbc_fetch_row($rs))
          //echo "<tr><td>$id</td>";
          echo "<td>$fcombo</td>";
          echo "<td>$lsym</td>";
          echo "<td>$esym</td>";
          echo "<td>$lsize</td>";
          echo "<td>$esize</td>";
          echo "<td class=\"center\"><a href=\"update_trnsym.php?id=$id\"><img src=\"images/edit-page-blue.gif\" title=\"Edit\" /></a></td>";
          echo "<td class=\"center\"><a href=\"delete_trnsym.php?id=$id\"><img src=\"images/delete.png\" title=\"Delete\" /></a></td></tr>";

A select page not connecting to the display page.

I assume this would work if I had two things:
1. <?php echo $_SERVER['PHP_SELF']; ?>
2. A Loop

Thanks in advance.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close