Jump to content

[SOLVED] Please help with form results > email


xcali

Recommended Posts

Hey guys

 

I have a little problem im trying to solve

I was following a "PHP and MYSQL for dynamic websites" book but without success

 

What i am trying to do is after xxxxx results are displayed users get a table like below:

317je5u.jpg

 

what i would like, is for them to be able to click the email and the default mail client opens up and creates new email to the user

so i got this:

 

...
...
$anymatches=mysql_num_rows($data);
if ($anymatches == 0){ 
echo "Sorry, but we can not find an entry to match your query<br><br>"; 
}
else{
echo "<table align='center' cellspacing='25' cellpadding='1'>";
echo "<tr>
					<td align='left'><b>First Name</b></td>
					<td align='left'><b>Last Name</b></td>
					<td align='left'><b>Contact</b></td>
					<td align='left'><b>Age</b></td> 
					<td align='left'><b>Ethnicity</b></td></tr> ";

while ($result = mysql_fetch_array($data))
	{ echo "<tr><td align='left'>" . $result['first_name'] . "</td>
			<td align='left'>" . $result['last_name'] . "</td>
			<td align='left'><a href="mailto: . $result['email'] .">" . $result['email'] ."</a></td>
			<td align='left'>" . $result['age'] . "</td>
			<td align='left'>" . $result['ethnicity'] . "</td> ";
	}
  echo "</table>";
    }
} 

 

now my problem is somewhere in:

<td align='left'><a href="mailto: . $result['username'] .">" . $result['username'] ."</a></td>

cause i keep getting a blank page whenever i do this

may i please get some pointers or suggestion on how to do this correctly?

 

thank you

should be this

<td align='left'><a href='mailto:"  . $result['username']  . "'>"  .  $result['username']  . "</a></td>

 

You were using double quotes in the href attribute when you should of been using single quotes or backslashing your double quotes.

Also you forgot the end quote for the href attribute

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.