So I have a standardized mail form that has certain generated details that must accompany it including a header image.
I am trying to find out how to add the image to the text form for when I send it.
I have
$img_path = 'image12.jpg'; //declaration
while($row = mysql_fetch_array($result))
{
echo "<tr>";
$emailContent=str_replace("\\r\\n","",$row["generic_email_text"]);
echo 'Test';
echo '<td width="450"><textarea name="genericemail">'.$img_path .$emailContent.'</textarea></td>';
echo "</tr>";
}
echo "</tr>";
echo "</table><p>";
I tried adding img_path to it but it won't work. I'm taking over from someone elses code which I always find difficult. All I get with this is the name of the img ("image12")
And yes I havnt done PHP in a while
Here's the PHP for pulling the form info
$fullName = $firstName . " " . $lastName;
$imageFile = str_replace = '<img src="http://css-tricks.com/examples/WebsiteChangeRequestForm/images/wcrf-header.png" alt="Website Change Request" />'; //Header here is just a place holder
$updatedEmailText = str_replace("%name%", fieldHtmlFormat($firstName), $updatedEmailText);
$updatedEmailText = str_replace("%firstname%", fieldHtmlFormat($firstName), $updatedEmailText);
$updatedEmailText = str_replace("%lastname%", fieldHtmlFormat($lastName), $updatedEmailText);
$updatedEmailText = str_replace("%duration%", fieldHtmlFormat($durationOfStay), $updatedEmailText);
$updatedEmailText = str_replace("%destination%", fieldHtmlFormat($arrivalCity), $updatedEmailText);
$updatedEmailText = str_replace("%travel%", fieldHtmlFormat($travel), $updatedEmailText);
return $updatedEmailText; .
edit:
changed code:
while($row = mysql_fetch_array($result))
{
echo "<tr>";
$emailContent=str_replace("\\r\\n","",$row["generic_email_text"]);
echo 'Test';
//LINE 50'<td width="450"><textarea name="genericemail"><imgsrc="'.$img_path.'"/>'.$emailContent.'</textarea></td>' }//LINE50
echo "</tr>";
echo "</table><p>";
You need to add <img>
tag in order to show the photo.
Replace the line:
echo '<td width="450"><textarea name="genericemail">'.$img_path .$emailContent.'</textarea></td>';
With this line:
echo '<td width="450"><textarea name="genericemail"><img src="'.$img_path.'"/>'.$emailContent.'</textarea></td>';
And also make sure that you have the correct file/url path for $img_path
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.