I'm new to php and working on a contact director that will do the following:
*User selects item from drop-down menu in html form.
*The php script connects to the db and returns all information about the one element (department abbreviation) that was selected.
*Prints the information (ideally) into a read only html form, but could also return the information as a plain table.
As of right now, I can connect to the db fine through my php script but that's about it. I would greatly appreciate any help I could get, even if it's just telling me a method or class that I should check out that would accomplish this task easily.
The following is the php script I have so far.
Thanks in advance,
hlmijendrix
Code: Select all
<?php
$username = "loginName";
$password = "password";
$hostname = "host";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$info=$_POST["abbr"];
$query=mysql_query("select Abbr, Last, First, Email, PhoneNumber, CampusAddress, NetID from Contacts where Abbr=('$info')", $dbhandle);
while ($row = mysql_fetch_array($query , MYSQL_NUM)
printf("Abbr: %s" , $query[0]);
?>