Help? - Retrieve link post data problem
Posted: Mon May 16, 2005 4:07 am
Hi,
I have two php pages. The first is called view.php which lists all of the asset numbers from my mysql database and displays them as a link. I also have a viewall.php page which takes the link post from view.php and uses this to display all of the data for that asset.
The problem is is that the data is not displayed. I have had this working with a form post, but not a link post.
Here is the code for the view.php page
...And here is the code for the viewall.php page that shows the link data
your help would be greatly appreciated.
regards,
mark
I have two php pages. The first is called view.php which lists all of the asset numbers from my mysql database and displays them as a link. I also have a viewall.php page which takes the link post from view.php and uses this to display all of the data for that asset.
The problem is is that the data is not displayed. I have had this working with a form post, but not a link post.
Here is the code for the view.php page
Code: Select all
<?php
$db = mysql_connect("localhost","NOT INCLUDED","NOT INCLUDED") or die("Problem connecting");
mysql_select_db("audit") or die("Problem selecting database");
$query = "SELECT * FROM dedicated order by type";
$result = mysql_query($query) or die ("Query failed");
//let's get the number of rows in our result so we can use it in a for loop
$numofrows = mysql_num_rows($result);
echo "<TABLE BORDER=\"0\" table width=\"100%\">\n";
echo "<TR bgcolor=\"#cccccc\"><TD font colour=\"red\"><b>Asset</b></TD><TD><b>Title</b></TD><TD><b>Customer</b></TD><TD><b>Type</b></TD><TD><b>IP address</b></TD></TR>\n";
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result); //get a row from our result set
if($i % 2) { //this means if there is a remainder
echo "<TR bgcolor=\"#ffff99\">\n";
} else { //if there isn't a remainder we will do the else
echo "<TR bgcolor=\"#ffffcc\">\n";
}
echo "<TD><font color=\"red\"><b><a href='viewall.php'?varl=".$row['asset'].">".$row['asset']."</a></b></font></TD><TD><font size=\"2\">".$row['title']."</TD><TD><font size=\"2\">".$row['customer']."</TD><TD><font size=\"2\">".$row['type']."</TD><TD><font size=\"2\">".$row['IP']."</TD>\n";
echo "</TR>\n";
}
//now let's close the table and be done with it
echo "</TABLE>\n";
?>...And here is the code for the viewall.php page that shows the link data
Code: Select all
<?php
foreach($HTTP_POST_VARS as $varname => $value)
$formVars[$varname]=$value;
$db = mysql_connect("localhost","","");
mysql_select_db ('audit');
$query="SELECT * FROM dedicated WHERE asset = \"".$_GET."\"";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$formVars = array();
$formVars["title"]=$row["title"];
$formVars["customer"]=$row["customer"];
$formVars["type"]=$row["type"];
$formVars["serial"]=$row["serial"];
$formVars["os"]=$row["os"];
$formVars["oemfull"]=$row["oemfull"];
$formVars["oslicense"]=$row["oslicense"];
$formVars["IP"]=$row["IP"];
$formVars["location"]=$row["location"];
$formVars["processor"]=$row["processor"];
$formVars["memory"]=$row["memory"];
$formVars["motherboard"]=$row["motherboard"];
$formVars["software"]=$row["software"];
$formVars["software2"]=$row["software2"];
$formVars["software3"]=$row["software3"];
$formVars["software4"]=$row["software4"];
$formVars["software5"]=$row["software5"];
$formVars["software6"]=$row["software6"];
$formVars["software7"]=$row["software7"];
$formVars["software8"]=$row["software8"];
$formVars["software9"]=$row["software9"];
$formVars["software10"]=$row["software10"];
$formVars["software11"]=$row["software11"];
$formVars["software12"]=$row["software12"];
$formVars["software13"]=$row["software13"];
$formVars["software14"]=$row["software14"];
$formVars["software15"]=$row["software15"];
$formVars["disksize"]=$row["graphics"];
$formVars["networkcard"]=$row["networkcard"];
$formVars["graphics"]=$row["graphics"];
$formVars["license"]=$row["license"];
$formVars["license2"]=$row["license2"];
$formVars["license3"]=$row["license3"];
$formVars["license4"]=$row["license4"];
$formVars["license5"]=$row["license5"];
$formVars["license6"]=$row["license6"];
$formVars["license7"]=$row["license7"];
$formVars["license8"]=$row["license8"];
$formVars["license9"]=$row["license9"];
$formVars["license10"]=$row["license10"];
$formVars["license11"]=$row["license11"];
$formVars["license12"]=$row["license12"];
$formVars["license13"]=$row["license13"];
$formVars["license14"]=$row["license14"];
$formVars["license15"]=$row["license15"];
$formVars["asset"]=$row["asset"];
$formVars["value"]=$row["value"];
$formVars["value2"]=$row["value2"];
mysql_close($db);
?>regards,
mark