Forum Moderators: coopster
I just want to know if this is correct? I encountered problems... It doues not output to my output text field... Hope you can help guys! Thanks!
Code:
<?php
$n = $_GET['n'];
$dbConn = mysql_pconnect("zione", "user", "password") or trigger_error(mysql_error(),E_USER_ERROR);
$query = "SELECT * FROM tbloutlet WHERE StoreID=".dbquote($n);
$result = $dbConn->Execute();
$row = $result->FetchRow();
//$dbConn->Close();
echo "var formObj = document.forms[0];"."\n";
echo "formObj.outlet.value = \"".$row['Outlet']."\";"."\n"
?>
[edited by: ergophobe at 4:57 pm (utc) on June 30, 2005]
[edit reason] thread title changed - no URLs in posts or titles please [/edit]
Also see if there's really any value in
echo "Outlet: ".$row['Outlet']."<br>";
I would also recommend validating input from GET. I understand it's an integer value
$n = (int)$_GET['n']; //returns 0 if not integer and there's no 0 row, so the db returns no output - quite safe
Best regards
Michal Cibor
PS. It may be clearer to get out of php for some time:
?>
var formObj = document.forms[0];
formObj.outlet.value = "<?php echo $row['Outlet'];?>";
<?php ...