Pauls74462 Posted July 25, 2010 Share Posted July 25, 2010 Below is a PHP code I found to get data from MySQL and show db info on a web page. What I like to do is to make the email link where I can click on it and send an email. What I need to know is what php line needs to be edited and how do I add the "mailto:" to the email address.The code live working can be seen at: http://softsevenorg.com/MySQL/GetTables.php <html><head><title>MySQL Table Viewer</title></head><body><?php$db_host = 'localhost';$db_user = 'root';$db_pwd = 'lptm42b';$database = 'sphinx';$table = 'spheres';if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database");if (!mysql_select_db($database)) die("Can't select database");// sending query$result = mysql_query("SELECT * FROM {$table}");if (!$result) { die("Query to show fields from table failed");}$fields_num = mysql_num_fields($result);echo "<h1>Table: {$table}</h1>";echo "<table border='1'><tr>";// printing table headersfor($i=0; $i<$fields_num; $i++){ $field = mysql_fetch_field($result); echo "<td>{$field->name}</td>";}echo "</tr>\n";// printing table rowswhile($row = mysql_fetch_row($result)){ echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td>$cell</td>"; echo "</tr>\n";}mysql_free_result($result);?></body></html> PS. The MySQL connections info in the above file is NOT the current info. Link to comment Share on other sites More sharing options...
MrFish Posted July 25, 2010 Share Posted July 25, 2010 You need to make a new page where there is an email form. Unless you want outlook, thunderbird, evolution mail, etc. to open when the click the link (which it already does), you will need to make an email form on your website.http://w3schools.com/php/php_mail.asp Link to comment Share on other sites More sharing options...
Pauls74462 Posted July 26, 2010 Author Share Posted July 26, 2010 You need to make a new page where there is an email form. Unless you want outlook, thunderbird, evolution mail, etc. to open when the click the link (which it already does), you will need to make an email form on your website.http://w3schools.com/php/php_mail.asp Clicking email does not work. Link to comment Share on other sites More sharing options...
thescientist Posted July 26, 2010 Share Posted July 26, 2010 Clicking email does not work.what did you do? That's not a very helpful response. I guess the first thing is, is do you understand the differences between using PHP and a form versus using mailto? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.