Jump to content

quick question (php)

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
mayo

mayo

    Newbie

  • Members
  • PipPip
  • 15 posts
Hi. I'm writing a very simple script. Im recieving 2 variables, body and exist, with the POST method from a flash application. Then I wish to create a 3rd variable named rBody, who will equal body if exist is true, and if exist is false, it will add " rvar= " in the beginning, then body. This is the code I used (didn't work):

$exist = $_POST['exist'];

$body = $_POST['body'];

if($exist == true){

	$rBody = $body;

} else {

	$rBody = "rvar=" . $body;

}

ty in advance.

#2
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
this should fix it

$exist = $_POST['exist'];

$body = $_POST['body'];

if($exist == 'true'){

	$rBody = $body;

} else {

	$rBody = "rvar=" . $body;

}


$_POST and $_GET variables are usually strings unless its set from inside PHP like
$_POST['var']=true;
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#3
mayo

mayo

    Newbie

  • Members
  • PipPip
  • 15 posts
thanks works! :D