PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 28th, 2012, 05:19 AM
shadowwebs shadowwebs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 3 shadowwebs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 4 sec
Reputation Power: 0
PHP-General - Html url in php variable

$greeting = 'Thank you for registering with Shadow Web Design. You can now <a href="login.php">Login</a> to your account.';

Hi, I have added the above in to my php code and its coming back as not liking it due to the "".

Can anyone help me with this one as to where it's falling short.

The idea is that after someone registers, they receive an automated e-mail welcoming them to the site which works fine. I now want to add in the url for the Login but this is failing.

any ideas as to why and how it should be set out?

Reply With Quote
  #2  
Old November 28th, 2012, 05:26 AM
Jacques1's Avatar
Jacques1 Jacques1 is online now
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,845 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 8 h 49 m 53 sec
Reputation Power: 813
Hi,

using double quotes in single quoted strings (and vice versa) is absolutely valid. So whatever problems you experience, they have nothing to do with the quotes.

Give us the full code and a concrete error description (including all error messages), then we might be able to help you.

Reply With Quote
  #3  
Old November 28th, 2012, 05:34 AM
shadowwebs shadowwebs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 3 shadowwebs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 4 sec
Reputation Power: 0
code:
$greeting = 'Thank you for registering with Shadow Web Design. You can now <a href="login.php">Login</a> to your account.';

$to = $email;
$from = "admin@[hidden from forum].co.uk";
$subject = "Member Registration";
$message = "Name: " . $name . "\nEmail: " . $email . "\nUserID: " . $userid . "\nPassword: [not provided for security] " .
"\nThank you for registering with [company name hidden from forum]. You can now " . $greeting";

****************

PHP Error Message

Parse error: syntax error, unexpected '"' in /home/a4649813/public_html/php/register/process.php on line 18

****************
Line 18 is: $greeting = 'Thank you for registering with Shadow Web Design. You can now <a href="login.php">Login</a> to your account.';

Reply With Quote
  #4  
Old November 28th, 2012, 05:47 AM
Jacques1's Avatar
Jacques1 Jacques1 is online now
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,845 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 8 h 49 m 53 sec
Reputation Power: 813
Are you sure that's the line? I'm getting this exact error in the last line
PHP Code:
"\nThank you for registering with [company name hidden from forum]. You can now " $greeting"; 

because of the double quote after $greeting.

But of course there could also be another error in the code before line 18 (which we can't check).

Reply With Quote
  #5  
Old November 28th, 2012, 06:10 AM
shadowwebs shadowwebs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 3 shadowwebs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 4 sec
Reputation Power: 0
$message = "Name: " . $name . "\nEmail: " . $email . "\nUserID: " . $userid . "\nPassword: [not provided for security] "
. "\n\nThank you for registering with Shadow Web Design. You can now <a href=\"login.php\">Login</a> to your account";

****
I have decided to get rid of the variable and do it via the above method instead. The e-mail is delivered however it displays as below:
****
Name: [not provided for security]
Email: [not provided for security]
UserID: [not provided for security]
Password: [not provided for security]

Thank you for registering with Shadow Web Design. You can now <a href="login.php">Login</a> to your account

****
As you can see, within the e-mail the whole text is displayed and is therefore not a clickable link...

Reply With Quote
  #6  
Old November 28th, 2012, 06:42 AM
Jacques1's Avatar
Jacques1 Jacques1 is online now
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,845 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 8 h 49 m 53 sec
Reputation Power: 813
Quote:
Originally Posted by shadowwebs
As you can see, within the e-mail the whole text is displayed and is therefore not a clickable link...


Then it's a plaintext mail and not an HTML mail. I guess you're using the mail() function? Use a mail library like PHPMailer instead. Sending HTML mails through mail() is pretty cumbersome, because you have to manually set the mail headers.

Reply With Quote
  #7  
Old November 28th, 2012, 02:09 PM
sunon sunon is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 3 sunon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 24 sec
Reputation Power: 0
give this a shot:

PHP Code:
 $headers  "MIME-Version: 1.0\nContent-Type: text/html; charset=iso-8859-1\n";
$headers .= "From: emailaddress\r\n";
$headers .= "Reply-To: emailaddress\r\n";

mail('emailaddress'$subjectnl2br($message), $headers); 

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP-General - Html url in php variable

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap