• Welcome to the Yamaha FZ6 Forums. Member registration disables ads and allows you to post and share. Register Here.

PHP Help

LERecords

Member
Elite Member
Joined
Mar 28, 2008
Messages
2,526
Reaction score
34
Points
48
Location
Shelburne, VT
Visit site
sooo.... does anyone know how to put a - or dash in between text and numbers in php.. i tired loading the - into a variable but it keeps subtracting my numbers.. i want to add variables using the following

$_SESSION['s1'] = $_POST['s1'] ;
$_SESSION['ca'] = $_SESSION['ca'] - 1;
$_SESSION['pt'] = $_SESSION['pt'] . $_SESSION['dash'];
$_SESSION['pt'] = $_SESSION['pt'] . $_SESSION['s1'] ;


as you see hte session dash is not getting added as text but as a subtractors due to the following output

kmc-4--5

how can i add the - as text and append it to a variable???
 
if i knew where the heck the extra dash was coming from... its cool.. im onto a different problem.. ill come back to it...
 
my god goop./.. your
\- thing made me go read up on how to work with operators, and it solved the whole problem i was having.. thanks man for the inspiration!! :thumbup:
 
Colin_A1-2.jpg
= :BLAA: LOL!
 
sooo.... does anyone know how to put a - or dash in between text and numbers in php.. i tired loading the - into a variable but it keeps subtracting my numbers.. i want to add variables using the following

$_SESSION['s1'] = $_POST['s1'] ;
$_SESSION['ca'] = $_SESSION['ca'] - 1;
$_SESSION['pt'] = $_SESSION['pt'] . $_SESSION['dash'];
$_SESSION['pt'] = $_SESSION['pt'] . $_SESSION['s1'] ;


as you see hte session dash is not getting added as text but as a subtractors due to the following output

kmc-4--5

how can i add the - as text and append it to a variable???

$_SESSION['ca'] = $_SESSION['ca'] . '-' . 1;

Dot is the string concatenation operator.

You can also use sprintf() function to generate formatted strings.

Remember about filtering the incoming data and escaping output.
 
Back
Top