[b]form.php[/b]
<form action="action.php?[COLOR="Red"]myVar=1[/COLOR]" method="post">
<input type='text' name='[COLOR="Green"]myVar[/COLOR]' value='[COLOR="green"]2[/COLOR]'>
<input type='submit' value='submit'>
</form>
[b]action.php[/b]
<?php
[COLOR="Blue"]$myVar=3[/COLOR];
echo [COLOR="Red"]$myVar[/COLOR]
echo [COLOR="Green"]$myVar[/COLOR]
echo [COLOR="Blue"]$myVar[/COLOR]
?>
The value of $myVar in action.php will be 3.
I like to discriminate url $myVar(1), form $myVar(2) and $myVar(3).
How can I discriminate them which are same name?
echo $_GET['myVar']; // 1
echo $_POST['myVar']; // 2
echo $myVar; // 3
Thank you. it’s very distinctive.
If I have another value from SQL “select myValue from myTable where id=1”,
How can I discriminate it from the others?
$_SQL(‘myVar’) or something?
Blue1
5
What does “discriminate” even mean when you talk about it in variable context?
What’s your goal?
oddz
6
I throw rocks at the variables I like to discriminate against.
A better term is probably discern.
dotJoon
7
discriminating $_POST[‘myVar’]; or $_GET[‘myVar’]; from myVar
Jay_P
8
I think you just answered your own question… a nice change!
Very simple, when you query something from database then it will come in different variable/array and you can use it with that array.