Reputation: 103
I was wondering is how to combine a (session) and (post) value to make a (title)value.
$position = $_POST['position'];
$division = $_POST['division'];
$title = $_SESSION['repcode'] +._.+ $_POST['position'];
I want is the outcome of the title would be
example output:
title = rep230_manager
how to do this?
Upvotes: 0
Views: 74
Reputation: 4604
You can also interpolate the variable values into the string if you find that easier
$title = "{$_SESSION['repcode']}_{$_POST['position']}";
Upvotes: 1
Reputation: 862
To concatenate string in PHP use . operator
$title = $_SESSION['repcode'] .'_'. $_POST['position'];
Also you can use " " or ' ' for concatenating. But ' ' will be few nanoseconds faster than " " as Double quotes execute the string but single quote doesn't so its faster.
Upvotes: 1