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
Share on other sites

thanks AV1611, but i need to "wrap" the codes in '$body' as that is the info i am going to send out via mail() function, that's why i use textarea.. any better suggestion so that i can do that? (place a link in my mail() $body)

thanks
Link to comment
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="user@tm.net.my";
    $mail->FromName = "ky";
    $mail->AddAddress("user@hotmail.com");

    $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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.