Hi again I am new to PHP and I am having an issue passing a variable to another page using the header method. Here is the code I am dealing with: I am getting user input and then sending it to a serverapi and recieving a numerical value back.. This all works I am then trying to send the value returned to another page to be used there. $to = "http://www.mydomain.com/mypage.php?rmid="+'$rmid'; header('Location: '. $to); exit; The url I get is: http://www.mydomain.com/0 If I use the following: $to = 'http://www.mydomain.com/mypage.php?rmid=+$rmid'; I get: http://www.mydomain.com/mypage.php?rmid=$rmid Can any tell me what I am doing wrong here. Also if anyone can tell me how I can combine the values of two text strings in php. i.e. a$= txt1 " " txt2 seems to be giving me problems as well Thank you ahead of time whomever you are.. Miles
if you use single quotes ' and ' the variables will be used with their names, not with their values. If you use double quotes, variables will be replaced with their values, but the best way to do this, is to put variables separately, example: $to = "http://www.somewebsite.com/". $variable; The operator for concatenation in php is . ( dot ) . $to = $text1 . " " . $text2; For more examples use http://www.php.net