Search code examples
phphtmlvariablesmailtosubject

mailto using variable missing out subject


I'm looking to those with far more experienced than me for a solution to a problem.

The following works partly.

echo "<td width='28%'>" .
    $qry['name'] .
    "<br>" .
    $qry['address1'] .
    "<br>" .
    $qry['address2'] .
    "<br>" .
    $qry['town'] .
    "<br>" .
    $qry['postcode'] .
    "<br>TeleNo : " .
    $qry['telephone'] .
    "<br>" .
    $qry['email'] .
    "<a href='mailto:" .
    $qry['email'] .
    "'?Subject=Thank%20You>  - Send eMail</a></td>";

It creates the table field OK and, when "Send eMail" is clicked, the email client pops up opening an email with the address in the To field OK but the Subject field is blank.

I've tried all combinations of single and double quotation marks but some fail while no working combination will fill the subject field in the email.

I could live with that but I'd really prefer it worked.

Any suggestions gratefully received.


Solution

  • Look at the closing quote, it should be after subject:

    <a href='mailto:" . $qry['email'] . "?Subject=Thank%20You'>
    

    NOT

    <a href='mailto:" . $qry['email'] . "'?Subject=Thank%20You>