Page 1 of 1

can anyone...

Posted: Wed Dec 10, 2003 9:29 am
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.........

Posted: Wed Dec 10, 2003 9:31 am
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

Posted: Wed Dec 10, 2003 9:37 am
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

Posted: Wed Dec 10, 2003 3:52 pm
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;
?>