Page 1 of 1

variable help please

Posted: Wed Jul 14, 2004 7:43 pm
by Pizmal
This is going to be hard to describe since i am new to PHP. I have a search page that gets data from a MYSQL database and displays it into a table (easy). Now when i show the ID number (workorder_ID) I turn it into a link to a formview page.

Code: Select all

while ($row= mysql_fetch_assoc($result)) {
  			print "<tr>";
			print "<td><a href="formview.php">".stripslashes($row['workorder_id'])."</a></td>";

$date = stripslashes($row['workorder_date']);
			print "<td>".date("m/d/y", $date)."</td>";

My problem is i want to carry the workorder_id number onto the next page. Went through search on this forum and it talks about sessions and security and that seems more complex than what i need. I dont care if someone alters the number. It would only allow them to change the page being view.

If you could possibly point me in the right direction that would be greatful. I thought I could use a $_request['id'] to save the variable but was unable to make it work

-- Pizmal


feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Wed Jul 14, 2004 7:49 pm
by evilmonkey
Why not encode it in the URL?

Code: Select all

print "<td><a href="formview.php?id=">".stripslashes($row['workorder_id'])."</a></td>";
That should do it...

Posted: Wed Jul 14, 2004 7:55 pm
by feyd
wouldn't he need to actually put the variable in the url ;) :P

Posted: Wed Jul 14, 2004 7:59 pm
by evilmonkey
$row['workorder_id]...that is the variable put into the url. :)

Thank you

Posted: Wed Jul 14, 2004 8:13 pm
by Pizmal
That worked. I was having problems with my code. I didnt remove the ' ' from the variable. Once i removed them it worked like a charm. Thanks for all your help.

What should i read up on to get more information on this?

-- Pizmal

PS: I will post the entire code next time so that you can see the PHP tags etc. Sorry i didnt do it this time. (first post)