You have the table, for the codes 🙂 i name it codes
if you posted the first form, you got a variable $_POST["comp_code"]
after the first form, lets create a query if comp_code has a value:
if(empty($_POST["comp_code"] ))
die("Comp code is missing, lets fill one");
$query = sprintf("SELECT * FROM codes WHERE comp_id='%d'" , $_POST["comp_code"] );
run that query:
$result=mysql_query($query);
check if this result has found, if not stop the program with an error message...
if(mysql_num_rows($result)<1)
die("No companiy was found!");
if(mysql_num_rows($result)>1)
die("Too many companie found with the same ID, its not soo good!!!");
if its ok, then pull their fields
$r=mysql_fetch_object($result);
And we know that we expect only one row from the database, becouse of this fact you don't need to use the while loop to get the field's values.
This method is very good one, becouse the field names will be your new object's indexes,
such as:
$r->comp_name , $r->comp_abbr_name , $r->homepage_url
Then lets print the field's values, using a textfield, and don't forget to use the hidden field, where you will store the $r->comp_id
What's not clear till this point? If you have functions in this code, i suggest check them in the manual to understand the syntax, and feel free to ask for more.
http://php.net
this issue is not completed yet, but to continue you need to understand these few steps 🙂