sgerbitz
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by sgerbitz
-
-
Attached is my code.
I am trying to replace the [br] with <br> in my summary section of this page. I am confused, I thought I had ti right.. there must be a typo somewhere
[code]
<?PHP
session_start();
require("access.php");
?>
<?php include("top2.php"); ?>
<?php
$query = mysql_query("SELECT * FROM `users` where USERNAME = '" . $_SESSION[UserName] . "'") or die ("Error: " . mysql_error());
$data = mysql_fetch_array($query);
?>
<table width="83%" height="486" border=0 cellpadding=2 cellspacing=0>
<tr>
<td height="23" colspan="2"><div align="left"><b> </b></td>
</tr>
<tr>
<td width="49%"> <blockquote>
<div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:1; left: 219px; top: 233px;">
<div align="center"><img src="<?php if ($data['PHOTO_URL']) { echo $data['PHOTO_URL']; } else { echo './images/no_pic.gif'; }?>" width="150" height="150" border="0" alt="<?php if ($data['USERNAME']) { echo $data['USERNAME']; } else { echo 'no photo'; }?>" />
</p>
</div>
</div>
<div id="Layer4" style="position:absolute; width:292px; height:23px; z-index:4; left: 338px; top: 192px;">
<div align="center">
<h3><span style="font-weight: bold">Your Current Profile</h3>
</div>
</div>
</blockquote>
</td>
<td width="51%"><div id="Layer2" style="position:absolute; width:329px; height:139px; z-index:2; left: 155px; top: 388px;">
<p><strong>Username:</strong> <?=$data['USERNAME']?>
<strong><br />Gender:</strong> <?=$data['GEN']?>
<strong><br />Country:</strong> <?=$data['COUNTRY']?>
<strong><br />State:</strong> <?=$data['STATE']?>
<strong><br />Year of Birth:</strong> <?=$data['BIRTH']?>
<strong><br />Email:</strong> <?=$data['EMAIL']?>
<strong><br />Last Update:</strong><?=$data['MONTH']?>/<?=$data['DAY']?>/<?=$data['YEAR']?> -- <?=$data['TIME']?>
</p>
</div>
<p align="justify"> </p>
<div id="Layer3" style="position:absolute; width:342px; height:347px; z-index:3; left: 508px; top: 219px;">
<p><b>My Summary:</b></p>
<p>
<?php
$SUMMARY = str_replace('[','<',$data['SUMMARY']);
$SUMMARY = str_replace(']','>',$data['SUMMARY']);
echo $data['SUMMARY'];
?>
</p>
<p> </p>
<p> </p>
</div></td></tr>
</table>
<?php include("bottom2.php"); ?>
[/code]
Need help with str_replace
in PHP Coding Help
Posted
I guess this si the code you're using to convert [br] tp <br>?
[code]$SUMMARY = str_replace('[','<',$data['SUMMARY']);
$SUMMARY = str_replace(']','>',$data['SUMMARY']);[/code]
If so change it to:
[code]$SUMMARY = str_replace("[br]", "<br />", $data['SUMMARY']);[/code]
Also why are you using [br] why not just hit enter to add a new line in your textarea, then use nl2br when you retrieve the data out of the database instead? Makes life so much easier.
[/quote]
its just an example, like [b] [u] ... I am trying to allow only a couple of html codes to be used in my registration script.
Could you help me fix the issue?
oops I didnt read the whole response...
[code]$SUMMARY = str_replace("[br]", "<br />", $data['SUMMARY']); [/code]
I tried that, and it still doent work.