0

echo $_GET[x] changing it into variable...

any code sugessions Please advice new to PHP

some inputs first change $_GET[x] to variable
and then echo

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by j_limboo
0

More input on this
Each time i dont have to write $_GET[x]
instead want make $varx=$_GET[x]
Can we do this and apply $varx

Edited by j_limboo: n/a

0

Yes you can do that.
However, you should check any querystring ($_GET) variables as they can be messed up - i.e. an user could write his/her own values. If you rely on users' goodwill to not try and break your code, you'll find that users WILL break your code.

0

this? if yes, write these in the somewhere in the top of your file, so you can use them everywhere!

<?php
//First
$something = $_GET["something"];
echo $something;

//You may use this:
//$something = htmlentities($_GET["something"], ENT_QUOTES);

?>

Depending on what you want to do with them, you may use htmlentities() to prevent malicious code echoed directly!

Edited by smartness: n/a

0

ardav and smartness thank you
doing it now, applying it
will show you code after it is complete for rectification

:)

Edited by j_limboo: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.