passed variable not working correctly
Posted: Mon Oct 27, 2008 12:13 pm
I have an error passing a variable
page 1 is set to pass $id (the id is a phone number..312-555-1212 for example)
Page 2 cannot retrieve the record
However, if there are no dashes between the numbers, it works.....
Page 1
Page 2
not sure why it doesn't recognize the full number...
thanks
page 1 is set to pass $id (the id is a phone number..312-555-1212 for example)
Page 2 cannot retrieve the record
However, if there are no dashes between the numbers, it works.....
Page 1
Code: Select all
echo "<a href=\"index.php?content=enteraccount2&id=$id\">Enter Account Info</a><br>\n";
Code: Select all
<?php
$accountid = $_GET['id'];
$query = "SELECT id,account,address1,city,state,zip,phone,rep from customers where id = $accountid";
$result = mysql_query($query) or die('Could not find that account');
$row = mysql_fetch_array($result, MYSQL_ASSOC) or die('No records retrieved');
$id = $row['id'];
$account = $row['account'];
$address1 = $row['address1'];
$city = $row['city'];
$state = $row['state'];
$zip = $row['zip'];
$phone = $row['phone'];
$rep = $row['rep'];
echo "<h1>$account</h1><br>\n";
echo "$address1<br>\n";
echo "$city, $state $zip<br>\n";
echo "$phone<br>\n";
echo "<br>\n";
echo "<b>Sales Rep:</b> $rep<br><br>\n";
echo "<a href=\"index.php?content=enteraccount2&id=$id\">Enter Account Info</a><br>\n";
echo "<a href=\"index.php\">Return Home</a><br>\n";
?>
thanks