Here is my code again, with the minor change to $partnum in the $_POST being declared as just "partnum".
<?php echo $_POST["partnum"]; ?> is the part number you are looking for.
<?php
$conn=pg_pconnect("dbname= user= password=");
$lookup=pg_exec($conn, "SELECT * FROM parts WHERE part_number='partnum'");
if(isset($_POST['partnum'])) {
echo "Great! You clicked the button!\n";
} else {
echo "Hmm...you must have come to this script without clicking the button.\n";
}
{
This next portion is where I think I am having the problem, not sure though. I am passing the variable 'partnum' to 'submitsearch.php', then calling that variable in the WHERE part of the query and assigning the result to the $lookup variable.
One other quick question, when you said I should use the same type of variable naming, did you mean to choose to either use the "$" for all or none?
{
echo '<table BORDER="1" ALIGN="LEFT">
<tr><th>Part Number</th><th>Description</th></tr>';
while($row = pg_fetch_array($lookup))
echo '<tr><td>'.$row['part_number'].'</td><td>'.$row['part_desc'].'</td></tr>';
echo '</table>';
}
?>
This is the output:
35-24000 is the part number you are looking for. Great! You clicked the button!
Part Number Description
Asking help again, thanks.
G