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.

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.

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

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

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.