post

For some reason, wouldn't let me post code, so lets try again.

This is the code I'm working with. I'm trying to get the e-mail address into the html code, but it will not do so. I can retrieve the variable from the function but it does not show up in the link. Any suggestions?

    echo "<a href='php_click.php?add=car'>Add Car</a>";

   if (isset($_GET['adID'])){
                    echo "Received information <br>";
                    //RUN A FUNCTION HERE TO SEE IF REGEX PICKS UP AN EMAIL
                    $plainEmail = $_GET['adID'];
                    loadad($_GET['adID']);
                    checkMail($_GET['adID']) . "<br>";

            } else {
                    echo "Is not a mailing list user.<br>";
            }

    function loadad($colMail){
    echo "<b>Email address: " . $colMail . "<br><br><br></b>";
    echo "<a href='mailto:" . $colMail . "'>" . $colMail . "</a>";
    echo "<p align='center'> <img id='Image-Maps-Com-image-maps-2016-11-29-212437' src='http://www.image-maps.com/m/private/0/94sm55oguavokhp2albcqok1c1_compad.jpg' border='0' width='1200' height='900' orgWidth='1200' orgHeight='900' usemap=
    '#image-maps-2016-11-29-212437' alt='' /> <map name='image-maps-2016-11-29-212437' id='ImageMapsCom-image-maps-2016-11-29-212437'> <area id='link1' alt='' title='link1' name='link1' href='php_click.php?add=nds1&adID='".$colMail." shape='rect' coords='86,181,329,629' style='outline:none;' target='_self'     /> <area id='link2' alt='' title='link2' name='link2' href='php_click.php?add=greenday&adID='" . $colMail . " shape='rect' coords='336,171,579,619' style='outline:none;' target='_self'     /> <area  alt='' title='link3' name='link3' href='php_click.php?add=bluemonday' shape='rect' coords='573,166,816,614' style='outline:none;' target='_self'     /> <area  alt=''  title='link4' name='link4' href='php_click.php?add=silversurfer'" . $colMail ." shape='rect' coords='813,181,1113,629' style='outline:none;' target='_self'     /> <area shape='rect' coords='1198,898,1200,900' alt='Image Map' style='outline:none;' title='Image Map' href='http://www.image-maps.com/index.php?aff=mapped_users_0' /> </map>";

    }

echo the html code inside php is bad practise and unstylish
Seperate just the HTML code and post it here cause i cannot understand anything

Member Avatar for diafol

As Stefan states - separate your markup and php as much as possible. For example:

echo "<a href='mailto:" . $colMail . "'>" . $colMail . "</a>";

Change to (as markup):

<a href="mailto:<?=$colMail?>"><?=$colMail?></a>

Stefan & Diafol,

Word, I will check this and re-do the code and post it back as best as possible. The mailto was a test to see if it worked (which it does), the picture map is where I'm having the issue. Give me a bit and I will see to repost. Thanks again -=]

./anthony

Diafol,

If I try your suggestion, it returns: 

Send us junk at: and it's blank. It I try it with the <?php $colMail ?> it also does the same thing. Suggestions? 

./anthony

EDIT:
Okay I think I see what is going on. I have to put the PHP code FIRST and then, add the HTML to the bottom of the page as shown: 

<?php $colMail = "this"; ?>
<a href=" <?=$colMail?> "><?=$colMail?></a>

Thank you for the information. I have completed what needs to be done. I've fixed the code. THANK YOU!! -=]

commented: Good stuff :) +15
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.