Link to home
Start Free TrialLog in
Avatar of mightofnight
mightofnightFlag for United States of America

asked on

How to generate a link that can pass on a variable?

Ok here is what i am trying to do!

I have a customer database and i want to make somethign that prints all the customers to the screen so that you can click on a customer and edit their information.  I know how to do this using a combo box and a form but i am looking for a more intuitive way of acomplishing this task.
ASKER CERTIFIED SOLUTION
Avatar of weznme
weznme

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mightofnight

ASKER

That was so easy it’s disgusting :P

Thanks a lot dude
Avatar of minichicken
minichicken

Hi

This way will display all customers in a HTML table, with one customer in each row and a edit link for each of the customers under appropriate table headers. When click on the "Edit" link, you will get redirected to the edit page and the customer id will also get passed to the edit page, so the system knows which customer to edit.

DISPLAY CUSOMTER IN TABLE**********************************************
<?
//DO DATABASE CONNECTION HERE

$query = mysql_query("SELECT * FRIN customer");
?>

<TABLE WIDTH ="100%" BORDER ="1">
<TR>
<TD>Customer Name</TD>
<TD>Customer Surname</TD>
<TD>Customer Email</TD>
<TD>Edit Customer</TD>
</TR>

<?

while ($row = mysql_fetch_assoc($query))
{
      echo "<TR>";
      echo "<TD>" . $row['customer_name'] . "</TD>";
      echo "<TD>" . $row['customer_surname'] . "</TD>";
      echo "<TD>" . $row['customer_email'] . "</TD>";
      echo "<TD><a A HREF ='edit_customer.php?id=" . $row['customer_id'] . "'>Edit</TD>";
      echo "</TR>";
}
?>

</TABLE>

EDIT CUSTOMER**********************************************
<?
//on this page you will do a query with something like this:
$query = mysql_query("SELECT * FROM customer WHERE customer_id = '$_GET[id]'");
?>
Thanks for the code you saved me some time... if i could i would give you some points to!

not that i need to do this right now but how do you do multiable variables?  Exp

the galleary i use on my website
http://www.mightofnight.com/wallpaper/index.php?album=1024x768%2F&pic=4K1-0.JPG

in this link it appears that there are two variables
album=1024x768%2F
pic=4K1-0.JPG
and that & is the seperator of the two variables? am i right in thinking this?
I know i just posted but just wanted to thank you guys again for the help, i feal like a little kid i am so excited. I was expecting to spend most of the day doing this and now i will be able to have this part of my form done in a couple of hours!
no prob :)