Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Emailing

Status
Not open for further replies.

M2E

IS-IT--Management
Aug 1, 2005
28
0
0
GB
Hi there,

Looking for some help with PHP emailing and Databases please!! I'm quite new to PHP and am teaching myself.

At present I have created a request form that users sign up to when they want to come to an event. This adds them to our DB and sends a confirmation email to MY address, which I then use to reply to. This method was ok at first, but now we are getting a lot more people signing up.

What I would really like to be able to do is the following, however my PHP knowledge is basic, any help on the following would be grateful:

When a user signs up to an event, I would like to send THEM an email, with a URL which they would click which would take them through to a page, which would then send info back to the DB saying that they have confirmed, which also proves the email address is valid.


Thanking you all in advance...

 
Getting your script to email them should be simply a case of changing the address the email is sent to.

mail ($to, $message, $header)

As for the confirmation link, you can make the script which generates the email build a link something like


then write the confirm script to pick up the user variable

$_GET['user']

Then use this to finish their sign-up since the value of user will be unique for each person.
 
Hi there,

I was told that I could use http_build_query to build my URL - however it seems this is only availabe in PHP5.


What is the equiv in PHP4?

Thanks again...

----Ment2Excel (M2E)----
--LEARN BY EXAMPLE--
 
..have managed to get a little further with this...

The problem I seem to be having now is that when i send the msg in my email script, I can seem to get the format right so that I can have my hyperlink in there to the confirmation page...see below

$msg = "Please click on this link to confirm your sign-up and validate your email address\n\n"<a href=\"urltest.php?firstname=$email;lastname=Evans">CLICK TO CONFIRM BOOKING!</a>;

the error message i get is:

Parse error: parse error, unexpected T_STRING in

Can someone tell me where I'm going wrong please!


Thanks...

----Ment2Excel (M2E)----
--LEARN BY EXAMPLE--
 
Let's see....

$msg =
begin string ==> "
string body ==>Please click on this link to confirm your sign-up and validate your email address\n\n
end string ==> "
string, however, continues ==> <a href=\"urltest.php?firstname=$email;lastname=Evans">CLICK TO CONFIRM BOOKING!</a>;

That assumes, however, that the error really is on that line. When PHP says "Parse error online x", PHP means, "You know, as I was at line x, I realized I was confused". The line with the actual error can be hundreds of lines earlier in your script.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
firstname=$email;lastname=Evans">
should this be
firstname=$email&lastname=Evans">

Binary Intelligence, true or false?
 
You need to escape all the quotes in the string, as mentioned above (but they missed one too). And follow litton1's advice, and you get:
Code:
$msg = "Please click on this link to confirm your sign-up and validate your email address\n\n[red]\[/red]"<a href=\"urltest.php?firstname=$email[red]&[/red]lastname=Evans[red]"[/red]>CLICK TO CONFIRM BOOKING!</a>;


[plug=shameless]
[/plug]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top