Jump to content

link in textarea


klinmy

Recommended Posts

can i place a link in textarea like what i did below?

[code]  <center><textarea name="Body"  ROWS="10" COLS="100">
this is text area body.

<A HREF = "form.php"><font face="verdana" size="2" > click here </A></FONT>&nbsp;&nbsp;


</textarea></center>[/code]

but it just printed out the total code of <a href= > instead of appearing as a link.

thanks
Link to comment
https://forums.phpfreaks.com/topic/4676-link-in-textarea/
Share on other sites

it's the codes i'm trying on. i need to get the info from previous page and then place it in the textarea as the email body together with a link.

[code]<form name="frm11" form action="" method=post>


  <center><textarea name="Body"  ROWS="10" COLS="100">
  <? include ("".$_SERVER['DOCUMENT_ROOT']."/cuti3/includes/config.php");
$_SESSION['uid'] = $uid;
$_SESSION['pwd'] = $pwd;

$query=mysql_query("SELECT * FROM staff WHERE id='$uid'");

<?php echo $_GET[id] ?> is a <?php echo $_GET[sex] ?>

<A HREF = "form.php"><font face="verdana" size="2" > click here </A></FONT>&nbsp;&nbsp;


</textarea></center>


<?


if(isset($send))
{
        
    require("class.phpmailer.php");
    $mail = new PHPMailer();
    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->Host = "smtp.tm.net.my"; // SMTP server
    $mail->From="[email protected]";
    $mail->FromName = "ky";
    $mail->AddAddress("[email protected]");

    $mail->Subject = "hi";
    $mail->Body = "$Body";
    $mail->WordWrap = 50;

    if(!$mail->Send())
    {
      echo "Message was not sent\n";
      echo "Mailer Error: \n" . $mail->ErrorInfo;
    }
    else
    {
      echo "Message was sent successfully!";
    }    
    
}[/code]
Link to comment
https://forums.phpfreaks.com/topic/4676-link-in-textarea/#findComment-16418
Share on other sites

You can put tye HTML in the textarea but need to send the email with a HTML header so the email client will parse the HTML and create a link.

The folloowing si what needs to be sent in the header fo the email:
[code]Content-Type: text/html; charset=iso-8859-1[/code]

As you are using phpMailer you need add this:
[code]$mail->IsHTML(true);[/code] after [code]$mail->WordWrap = 50;[/code] i believe

So now when you send your email. Your html should be parse by the email client and so a link should appear where the HTML is.

Read [a href=\"http://phpmailer.sourceforge.net/tutorial.html#4\" target=\"_blank\"]here[/a] for sending HTML mail with phpMailer.
Link to comment
https://forums.phpfreaks.com/topic/4676-link-in-textarea/#findComment-16453
Share on other sites

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.