can anyone...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kujtim
Forum Commoner
Posts: 35
Joined: Sat Oct 25, 2003 4:00 am
Location: kosovo
Contact:

can anyone...

Post by kujtim »

in one scipt i got this code but i dont now what it means
this is a script :

$link = $PHP_SELF."?item_type_id=$row[item_type_id]&item_id=$row[item_id]";
$edit_link = $PHP_SELF."?file_id=5&item_id=$row[item_id]&task=edit";
break;

specially I dont now what this sign (?)mean in thet script.........
User avatar
aquila125
Forum Commoner
Posts: 96
Joined: Tue Dec 09, 2003 10:39 am
Location: Belgium

Post by aquila125 »

if you output this you get:

currentphppage.php?item_type_id=item_type_id_from_db&item_id=item_id_from_db

this gives you a normal url with some $_GET variables in it..

you should change the code a bit.. replace $PHP_SELF with $_SERVER['PHP_SELF'] since $PHP_SELF is depricated
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

PHP_Self

Description
The filename of the currently executing script, relative to the document root.

NOTE
$PHP_SELF should not be used because it will not work without register_globals being enabled. Rather, you should use $_SERVER['PHP_SELF'] for it.

found an explanation here http://www.phpfreaks.com/phpref/34.php

also without meaning to sound detrimental you can find all syntax with descriptions of use and meaning in the PHP manual here
http://www.php.net/manual/en/

but good look, ive done the same seemingly not been able to find something so just go on here, but honestly these guys say read the manual for a good reason

Good Luck mate
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

Here is an example. Lets say the script holding the code mentioned in the first post was located @ http://www.example.com/items/index.php

Here is what those links would output:

Code: Select all

<?php

$link = $PHP_SELF."?item_type_id=$row[item_type_id]&item_id=$row[item_id]";
echo $link;  // would output a variation of:  example.com/items/index.php?item_type_id=55&item_id=397
$edit_link = $PHP_SELF."?file_id=5&item_id=$row[item_id]&task=edit";
echo $edit_link; // would output a variation of: example.com/items/index.php?file_id=5&item_id=397&task=edit;
?>
Post Reply