0

Hi, im new to PHP programming and ive tried a few forums on the net with this question and so far no answers.

I have a php form that is working fine with a pre-determined email address, part of the code is as follows:

    $data_email_sender->AddToAddr("name<name@website.com>");

I also have a variable that displays fine on the page: (shows an email address passed via previous page)

    <?php echo $_GET['ID']; ?>

So what i am trying to do is combine the two so that it would use the 'ID' as the <name@website.com>. Something like:

    $data_email_sender->AddToAddr("name<?php echo $_GET['ID']; ?>");

I know this is incorrect, but it shows what i am trying to do. Ive tried various ways and so far no success!

Hope someone on daniweb can help. Thanks in advance!

2
Contributors
3
Replies
4
Views
4 Years
Discussion Span
Last Post by adam.adamski.96155
0
$data_email_sender->AddToAddr("name<" .$_GET['ID']. ">");

You don't need to echo the GET var as you are already in a PHP block.
Or for tidiness, you can build the string separately -

$str = "name<";
$str.= $_GET['id'];
$str.= ">";
$data_email_sender->AddToAddr($str);

Hope this helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.