Jump to content

Archived

This topic is now archived and is closed to further replies.

FloridaNutz

linking with info to php

Recommended Posts

I will edit this better after I get a response...

I'm creating a basic contact database and i'm having trouble with an option I'm trying implement.  On the page that lists the mySQL table, I'm trying to find a way to transfer information of which entry it's at so I can edit that entry by using a image.png and link...    ...or am I just crazy and my brain is fried from looking through all these books and forums?

Example:
List.php                                              edit.php
1 Entry  :)
2 Entry  :)                                      / 4 Entry being edited
3 Entry  :)                                      /
4 Entry  :o  <user clicks this image  /
5 Entry  :)

Share this post


Link to post
Share on other sites
Actually, if you're clicking a link then the variable would be in the $_GET array

[code]<a href='edit.php?id=4><img src="editme.gif" ...></a>[/code]

And edit.php begins:

[code]<?php
$id = $_GET['id'];
...
[/code]

Share this post


Link to post
Share on other sites
OK, I thought it was something like that but i didn't know how to do that in the loop I was making...

[code]
$result = @mysql_query($sql, $connection) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$UCF_id = $row['UCF_id'];
$barName = stripslashes($row['barName']);
        ......
            $edit = '<a href="edit_bar_basic.php"><img src="../images/edit.png" width="16" height="16" border="0"></a>';
        ......
$display_block .= "<p><strong>$barName:</strong> $barAddress, $barCity $barZip<br>
  Phone: $barPhone  VIP Line: $barVIP $view $edit $delete </p><br>"; }

[/code]

... I tried doing
[code]$edit = '<a href="edit_bar_basic.php?"$UCF_id"">[/code]

...but that is obviously wrong... (ucf_id is my id for each entry)

Share this post


Link to post
Share on other sites
[code]$edit = '<a href="edit_bar_basic.php?id='. $UCF_id. '"><img src=" ....[/code]

Share this post


Link to post
Share on other sites
Thank you for the quick reply!  I must have missed that lesson on the periods lol.  Thank you!  Just let you know, I am teaching myself PHP in two days lol!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.