0

Hi, Ive already started a thread similar to this but for a different form format. this one is as follows...

Im struggling with the correct code to do the following... probably something simple to many but im new to PHP and learning as I go.

I have a simple php form with the line of code:

$your_email ='yourname@your-website.com';

I want to use a variable as the email address, which currently works as:

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

How can I combine the two so that the email would use the 'ID' as the email address? Ive tried various ways but dont seem successful.

$your_email ='<" .$_GET['ID']. ">';

Thanks in advance.

Edited by david.f.smith.351: title

4
Contributors
4
Replies
9
Views
5 Years
Discussion Span
Last Post by adam.adamski.96155
0

Seems to be a concat issue?

The string is already complete. the string contains a complete email address such as 'name@website.com'. I want to use that complete single string as the email address such as:

    $your_email ='GET['ID']">';

The standard code is already:

    $your_email ='yourname@your-website.com';

But im unsure how the syntax should look to include the single variable.

Edited by david.f.smith.351: addition

0
$your_email = $_GET['ID'];
$your_email = '<' . $_GET['ID'] . '>'; // enclosed with < >

Edited by pritaeas

0

$your_email ='<" .$_GET['ID']. ">';

Your mistake was to mix the double and single quotes - "<" .$_GET['ID'] .">" works, and so does '<' .$_GET['ID'] .'>', but not the mixture that you have. You really need to learn how to concatenate strings as you have to do this very often in web pages and PHP and it is relatively simple.

Edited by adam.adamski.96155

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.