python72 Posted February 12, 2011 Share Posted February 12, 2011 I am trying to store website address in a variable but when I do so the dots in the address are missing. I guess it takes it as string concatenation, for example: $address='www.lottocomplete.com'; will actually give me: wwwlottocompletecom How can I make sure these dots will be preserved? I am also trying to store email address in a variable but I get error, something about @ symbol being in wrong spot, wonder how this can be resolved as well. One more questions relates to the new line issue that I have when I concatenate string, for example if I do the following: $string = "1\n"; $string .= "2\n"; $string .= "3\n"; I would think that each number would be printed on new line but instead it shows up as: 123 What am I doing wrong? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 12, 2011 Share Posted February 12, 2011 For the first issue, there's no reason for that to happen. Can you post the actual problematic code? The second issue, if you look at the html source, those will be on new lines. To get it to render in the browser on new lines, you'd need to use nl2br. Quote Link to comment Share on other sites More sharing options...
python72 Posted February 12, 2011 Author Share Posted February 12, 2011 Here is the code, when I receive the email the dots in the website address are missing. if(@mysql_query($sql)){ $yoursite = 'www.lottocomplete.com'; $webmaster = 'Webmaster'; $youremail = 'webmaster@lottocomplete.com'; $subject = "You have successfully registered at $yoursite..."; $message = "Dear $previousfname, you are now registered at our web site. To login, simply go to our web page and enter in the following details in the login form: Username: $previoususername Password: $previouspassword Please print this information out and store it for future reference. Thanks, $webmaster"; mail($previousemail, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion()); //$urlname = urlencode($$_POST['username']); header("location: www.lottocomplete.com/registered/thankyou.php"); } else{ $errormessage = "Your information was not entered into our database.\n Please check your information and try again."; } Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 12, 2011 Share Posted February 12, 2011 I still don't see any reason for it. What's displayed if you change 'mail' to 'echo'? Quote Link to comment Share on other sites More sharing options...
python72 Posted February 12, 2011 Author Share Posted February 12, 2011 When I use the following: echo "$yoursite"; The address is displayed properly with dots in it, I guess it has something to do with the emailing, do you have any idea what can cause it? When I try to save email addres in variable I get error message related to @ symbol, how should this be done, I am trying to do the following: $email='webmaster@lottocomplete.com'; Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 12, 2011 Share Posted February 12, 2011 No reason for that to happen either. What is the error? Quote Link to comment Share on other sites More sharing options...
python72 Posted February 12, 2011 Author Share Posted February 12, 2011 Pikachu, Not sure what was the problem but now everything is working ok. The dots show in my website address and it takes the email without a hitch, I guess there is something else causing erratic errors, will have to investigate that before I progress any further. Thanks a lot for all your help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.