FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP Question - Solved





wormhole.v2
Ok sry I'm just starting learning PHP and I wanted to know how the bold part of the url is used in the php script:
Quote:
http://www.64digits.com/games/index.php?cmd=view_game&id=613&download=1


Basically I don't know what this is called and that's why I haven't been able to find anything about it so even someone telling me what this is called would be helping...

I would really appreciate any help I get here...

Thanks.
benjad
This is one of the ways you can send data between pages in your site. for example:

cmd=view_game

cmd is a variable, and view_game is the value assigned to that variable. This information can be extracted from the url in a php script by the variable

$cmd = $_GET[cmd];



Might I suggest a good php tutorial, starting here:
http://www.w3schools.com/php/default.asp
cavey
Code:
<?php

# Example:

echo $_GET['cmd']; // will output "view_game"
echo $_GET['id']; // will output "613"
echo $_GET['download']; // will output "1"

?>


($_GET means the variable comes from the url.)

The text in the url is variables and the values of them. F.ex. the variable id has the value 613. In your script, you can check what the variables contain, and then generate your site based on those answers. F.eks. show info about a game with id 613 from your database.

When you make your url deside which file to include or what row to get from the database, you must remember to check each and every variable, so that your guests cannot use the url to destroy your site/database or see info/files they are not supposed to see. F.ex. id should only contain numbers and not be below zero.

Good luck learning php! It is very interresting!
wormhole.v2
Thanks a ton... I was looking all over for this and I couldn't find it anywhere...

Thank you all SO much!!!

Laughing
Related topics
php question
JSP and PHP Question
PHP Question
PHP Question
a grouping question?
PHP question
PHP question, $_SESSION[] gets changes to by $_POST var
PHP Question: '.../something.php/something_else.png'
Need help with a HTML / PHP question.
A quick PHP Question! You know the answer! Answer ASAP .
Simple PHP question...
O'calhoun's reusable stupid php question thread [NEW]
MySQL and PHP Question
PHP question about passing variables (noob)
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.