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

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

Member Avatar for diafol

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.

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!

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

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.