Note that there are some explanatory texts on larger screens.

plurals
  1. PORetriving data from database based on user input
    primarykey
    data
    text
    <p>I am new to php, and I am learning the basics, I designed a form that has a dynamic drop down menu where the options are populated directly from my Access DB. After the user choose an option, the information related to that option would be displayed in a operate page, but that does not work properly. I run over my code for days and I do not seem to get what is wrong. The commented code seems to be my source of problem. this is the code</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Menu&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;?php // This would be the value passed from the previous php page $option =$_POST['myDropdown']; // for testing purposes print("$option"); // print image of the menu item or dish print &lt;&lt;&lt; HERE &lt;p&gt; &lt;img src = "DishesPictures/Dish-$option.png" border="1" bordercolor="black" alt = "die: $option" /&gt; &lt;/p&gt; HERE; $conn = new COM("ADODB.Connection") or die("Cannot start ADO"); $connString= "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\\ectserver\\naljalidi\\Database\\Menu.mdb"; //creates the connection object and define the connection string // for testing purposes print("$connString"); $rs=$conn-&gt;Execute("SELECT ItemID,ItemDesc,Price FROM Menu WHERE ItemID=$option;"); //if (!$rs-&gt;EOF) //{ // $ItemID=$rs-&gt;Fields("ItemID"); // $ItemDesc=$rs-&gt;Fields("ItemDesc"); // print("$ItemID"); // print("$ItemDesc"); //} $rs-&gt;Close(); ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>My DB information: Database Name: Menu Table: only one , named Menu Field: ItemID(PK, AutoNumber), ItemDesc(Text), Price(Currancy)</p> <p>Any help? Thank you</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload