Current location: Hot Scripts Forums » Programming Languages » PHP » keep formating


keep formating

Reply
  #1 (permalink)  
Old 02-11-04, 07:13 AM
woyrz's Avatar
woyrz woyrz is offline
Newbie Coder
 
Join Date: Dec 2003
Location: montreal
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Red face keep formating

I juste want to know if there's a wayt to keep the text input from a user as the way they format it.

i'm building a kind of send a card to a friend for the St-valentine

http://www.mediaflexdesign.com/valen...Programingtalk

i want when the user is formating the message that will stay the same when then personne who receive the card have it on is card

the way i am proceeding now

1- i insert all feild in mysql

2 - when the pesonne get a card that is the script

PHP Code:

<?php

$conn 
mysql_connect("127.0.0.1""rbruzzese","interdec") or die (mysql_error());
mysql_select_db("mediaflexdesign_com_-_test"$conn) or die(mysql_error());

//mysql_query($add_card) or die(mysql_error());

$sql mysql_query("SELECT * FROM `valentin` WHERE 1 AND `id` = $_GET[id]  AND `pass` = $_GET[no]  LIMIT 1"); 





$loadcard mysql_fetch_array($sql);
$id $loadcard['id'];
$email_env $loadcard['email_env'];
$email_rec$loadcard['email_rec'];
$nom_env $loadcard['nom_env'];
$nom_rec $loadcard['nom_rec'];
$mes $loadcard['mes'];
$choix $loadcard['choix'];
$date $loadcard['date'];
$pass $loadcard['pass'];
$viewcard $loadcard['viewcard'];
$dateview $loadcard['dateview'];
$view $loadcard['view'];

if (
$view == no){
$add_card " UPDATE valentin SET dateview = NOW(), view = 'yes' WHERE `id` = '$id'";
mysql_query($add_card) or die(mysql_error());
}

//print "$id $email_env $email_rec $nom_env $nom_rec $mes $choix $date $pass" ;
if($_GET[no] != $pass) {
print 
"error";
}
?>
<html>
<head>
<title>Card</title>
<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Nom {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: bold;
    color: #333399;
}

.msg {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: normal;
}

.envoyer {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: bold;
    color: #333399;
}
-->
</style>
</head>

<body class="body">
<?php
print $carte;
?><div align="center">
<table>
<tr>
<td><table align="center" border="0" cellspacing="2" cellpadding="0" class="table"><tr><td align="center"><?php include("$choix.php"); ?><br></td>
</tr></table></td>
</tr>
<tr><td>
<br><table align="center" border="0" cellspacing="2" cellpadding="0" class="table" width="100%">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td class="Nom"><?php echo $nom_rec;?></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td class="msg"><?php echo $mes;?></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right" class="envoyer"><?php echo $nom_env;?></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><a href="index.php?nom=<?php echo $nom_rec;?>&email=<?php echo $email_rec;?>">Send
    to a friend</a></td>
</tr>

</table>
</td></tr>
</table>
</div>
</body>
</html>
http://www.mediaflexdesign.com/valen...43&no=81588587

(in the text you have there i put somme return and spaces)



the probleme is it if a put some return it won't show up same thing for the multipule space.

What i should do ?
Reply With Quote
  #2 (permalink)  
Old 02-12-04, 08:07 AM
Stefan's Avatar
Stefan Stefan is offline
Junior Code Guru
 
Join Date: Jun 2003
Location: Utrecht, The Netherlands
Posts: 599
Thanks: 0
Thanked 0 Times in 0 Posts
what you need is the nl2br() function
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 08:47 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.