The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Web Programming > PHP


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags: , ,

Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 04-29-2008, 03:01 AM
sssddd sssddd is offline
Novice
Join Date: Apr 2008
Posts: 10
iTrader: (0)
sssddd is on a distinguished road
how do those page.php?number things work

I have a comment script that has a bunch unique ids. It's called by the code below
PHP Code:
<?php
require('inc_rate.php');
getComments("$id");
submitComments("$id","$PHP_SELF");
?>
Now I have different article pages differentiated by different ids ($id) where I want to add this script, but I dont want to have the comment and submission page on the same article page.

So i want the above code to be on a new page, probably comments.php and hyperlink to my article pages like http://mysite.com/comments.php?$id

So how exactly do I pass the $id on comments.php?$id to the page itself

Please ask anymore question if I am not being clear

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #2 (permalink)  
Old 04-29-2008, 09:07 AM
MrPickle's Avatar
MrPickle MrPickle is offline
Sr. Programmer
Join Date: Nov 2007
Location: England, Lincolnshire
Posts: 303
iTrader: (0)
MrPickle is on a distinguished roadMrPickle is on a distinguished roadMrPickle is on a distinguished road
I think that has to do something with get, PHP GET

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #3 (permalink)  
Old 04-29-2008, 10:57 AM
sssddd sssddd is offline
Novice
Join Date: Apr 2008
Posts: 10
iTrader: (0)
sssddd is on a distinguished road
it looks like the get thing only generates the the hyperlink with the form ID, but not pass ID to the designated php page

I am not getting the right results, hmm thanks

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #4 (permalink)  
Old 04-29-2008, 09:07 PM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Admin
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 442
iTrader: (0)
TeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to behold
http://mysite.com/comments.php?page_id=$id

Then, you can access the value of $id by
PHP Code:
<?php
require('inc_rate.php');
getComments((int)$_GET['id']);
submitComments((int)$id,$PHP_SELF);
?>
Assuming your page id's are integers.

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #5 (permalink)  
Old 04-29-2008, 10:51 PM
sssddd sssddd is offline
Novice
Join Date: Apr 2008
Posts: 10
iTrader: (0)
sssddd is on a distinguished road
wow this is really interesting, but can explain to me what exactly is page_id, and what is its relationship to $_GET['id']

thanks a bunch

yeah they are all integers, and the code above is the only code in comment.php


__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #6 (permalink)  
Old 04-29-2008, 10:55 PM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Admin
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 442
iTrader: (0)
TeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to behold
The pattern in filename.php?variable_name=value&variable_name_2=v alue2&...

In PHP you can access the values through the global $_GET array. $_GET includes all variables passed in the URL as shown above. From the example above, $_GET['variable_name'] would be equal to "value" and $_GET['variable_name_2'] would be equal to "value2".

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #7 (permalink)  
Old 04-30-2008, 01:50 AM
sssddd sssddd is offline
Novice
Join Date: Apr 2008
Posts: 10
iTrader: (0)
sssddd is on a distinguished road
http://mysite.com/comments.php?page_id=$id

so if that is my link

should my code on the comment.php page be
PHP Code:
   <?php
require('inc_rate.php');
getComments((int)$_GET['page_id']);
submitComments((int)$_GET['page_id'],$PHP_SELF);
?>
so anywhere with $id I should replace with $_GET['page_id'] on that page?

Thanks a bunch I am getting this

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #8 (permalink)  
Old 04-30-2008, 09:29 AM
TeraTask's Avatar
TeraTask TeraTask is offline
PT Admin
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 3
Join Date: Jun 2007
Location: Reno, NV
Posts: 442
iTrader: (0)
TeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to beholdTeraTask is a splendid one to behold
Yes. I made a typo in my original code up there. You've got it now.

__________________
Jeremy Miller
Content Farmer - Optimized Automated Blog Posting

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 12:55 AM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50