Jump to content


Photo

linking with info to php


  • Please log in to reply
5 replies to this topic

#1 FloridaNutz

FloridaNutz
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 19 August 2006 - 08:06 PM

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  :)

#2 FloridaNutz

FloridaNutz
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 19 August 2006 - 08:18 PM

i'm an idiot and my brain is fried.... $_post[variable]

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 19 August 2006 - 08:22 PM

Actually, if you're clicking a link then the variable would be in the $_GET array

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

And edit.php begins:

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

Legend has it that reading the manual never killed anyone.
My site

#4 FloridaNutz

FloridaNutz
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 19 August 2006 - 09:45 PM

OK, I thought it was something like that but i didn't know how to do that in the loop I was making...

$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>"; }


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

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

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 19 August 2006 - 09:49 PM

$edit = '<a href="edit_bar_basic.php?id='. $UCF_id. '"><img src=" ....

Legend has it that reading the manual never killed anyone.
My site

#6 FloridaNutz

FloridaNutz
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 19 August 2006 - 09:51 PM

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!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users