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!

$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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.