Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-10-30
6
Medium Priority
?
225 Views
Last Modified: 2008-02-20
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.
0
Comment
Question by:mightofnight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Accepted Solution

by:
weznme earned 2000 total points
ID: 12453014
$customer_id = 1; // get from database
echo '<a href="edit_customer.php?customer_id=' . $customer_id . '">' . $customer_name . '</a>';

edit_customer.php:
echo $customer_id;
0
 
LVL 2

Author Comment

by:mightofnight
ID: 12453157
That was so easy it’s disgusting :P

Thanks a lot dude
0
 
LVL 12

Expert Comment

by:minichicken
ID: 12453191
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]'");
?>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Author Comment

by:mightofnight
ID: 12453221
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?
0
 
LVL 2

Author Comment

by:mightofnight
ID: 12453288
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!
0
 
LVL 12

Expert Comment

by:minichicken
ID: 12453621
no prob :)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question