Jazajay
Active Member
Hi peeps,
Now I have been trying to get this to work for some time and I appear to be a moron.
Useful stuff to know.
Program I am developing:
Send an email form for a custom CMS.
Problem with:
Getting the signature to show exactly how it does when it will be sent in the textarea tag.
Some code:
<b>Your signature will be added to the end of this email 3</b>
</p>
<p>
<?php
$select="SELECT signature FROM sometable"; //Write the select from DB query
$query=mysqli_query($connectionVariable,$select); //Query the DB
$result=mysqli_fetch_assoc($query); //Get the results
extract($result); //extract them so I can call them by their names
$sig=nl2br($signature); //Add br tags to any line breaks
$sig2=preg_replace("/<br \/>/","\n\n",$sig); //Remove the br tags and replace them with 2 new lines
echo $sig;?> //Show the user the signature as it will appear.
</p>
<?php if(isset($_GET['sig'])){ //If the get variable is set to change the signature show the edit signature form.
?>
<form action="" method="post">
<p>
<textarea name="sig" cols="10" rows="10"><?php echo $sig2;?></textarea> //Show a textarea with the db output in but with line breaks in instead of br tags
</p>
<p>
<button type="submit">Change your signature</button>
</p>
</form>
<?php }?> //end the if statement
<p>
<a href="admin/send-an-email/edit-your-signature">Edit your signature</a>
</p>
<p><button type="submit"><img src="img/send.jpg" alt="Send your email" /></button></p>
</form>
Right so my output is currently looking like this in the textarea tag:
Kind regardsFirst Name Last NameTelephone: 01234567890Email....
When it should be outputting as:
Kind regards
First Name Last Name
Telephone: 01234567890
Email....
Now if I just add the br added variable it looks like:
Kind regards<br />First Name Last Name<br />Telephone: 01234567890<br />Email....
Which is not great for none techies. Also I don't like things that I can't do and I can't see why.
Can someone explain my stupidity please as I'm at a loss.
Now I have been trying to get this to work for some time and I appear to be a moron.
Useful stuff to know.
Program I am developing:
Send an email form for a custom CMS.
Problem with:
Getting the signature to show exactly how it does when it will be sent in the textarea tag.
Some code:
<b>Your signature will be added to the end of this email 3</b>
</p>
<p>
<?php
$select="SELECT signature FROM sometable"; //Write the select from DB query
$query=mysqli_query($connectionVariable,$select); //Query the DB
$result=mysqli_fetch_assoc($query); //Get the results
extract($result); //extract them so I can call them by their names
$sig=nl2br($signature); //Add br tags to any line breaks
$sig2=preg_replace("/<br \/>/","\n\n",$sig); //Remove the br tags and replace them with 2 new lines
echo $sig;?> //Show the user the signature as it will appear.
</p>
<?php if(isset($_GET['sig'])){ //If the get variable is set to change the signature show the edit signature form.
?>
<form action="" method="post">
<p>
<textarea name="sig" cols="10" rows="10"><?php echo $sig2;?></textarea> //Show a textarea with the db output in but with line breaks in instead of br tags
</p>
<p>
<button type="submit">Change your signature</button>
</p>
</form>
<?php }?> //end the if statement
<p>
<a href="admin/send-an-email/edit-your-signature">Edit your signature</a>
</p>
<p><button type="submit"><img src="img/send.jpg" alt="Send your email" /></button></p>
</form>
Right so my output is currently looking like this in the textarea tag:
Kind regardsFirst Name Last NameTelephone: 01234567890Email....
When it should be outputting as:
Kind regards
First Name Last Name
Telephone: 01234567890
Email....
Now if I just add the br added variable it looks like:
Kind regards<br />First Name Last Name<br />Telephone: 01234567890<br />Email....
Which is not great for none techies. Also I don't like things that I can't do and I can't see why.
Can someone explain my stupidity please as I'm at a loss.