Forum Moderators: coopster
in the current page, i would like a variable R in the format of A/B/C
for example: if A's value was 12, B's value was 3, and C's value was 10, R would be: 12/3/10
here is wat i have, what have i done wrong?
<?php
$R = '$_POST['A']' + '/' + '$_POST['B']' + '/' + '$_POST['C']';
echo $R;
?>
Its two things: the syntax you're using to identify the new variable's elements and the method you're attempting to use for concatenation.
$R = $_POST['A']."/".$_POST['B']."/".$_POST['C']; echo $R; $_POST[] is an array. $_POST['A'] is an element of that array, not a string, so it doesn't get quoted. / is a string element. Also, be careful with using single-quotes instead of double-quotes, as in PHP single-quotes (apostrophes) can cause an object to be created, depending on where and how they are used. Neat, huh? Welcome to PHP, where all things old are new again!