Alright... :)
Printable View
Alright... :)
BTW if you want o visually see the page it's located atPHP Code:<form id="form1" name="form1" method="post" action="">
<strong> </strong>
<label>
<input type="hidden" name="user" id="user" READONLY <?php if(isset($_COOKIE['ID_my_site'])){?> value="<?php echo $_COOKIE['ID_my_site'];?>" <?php }?> />
<input type="button" value="Check Comments" onClick="window.location.href=window.location.href">
</label>
<p><strong>Announce: <a href="#post" onclick="insert_ubb(document.getElementById('comments'), '[b]', '[/b]'); return false;"> <img src="images/comment_images/b-b.gif" width="18" height="18" hspace="1" border="0" title="Bold Selected Text"></a><a href="#post" onclick="insert_ubb(document.getElementById('comments'), '[i]', '[/i]'); return false;"><img src="images/comment_images/b-i.gif" width="18" height="18" hspace="1" border="0" title="Italicize Selected Text"></a><a href="#post" onclick="insert_ubb(document.getElementById('comments'), '[u]', '[/u]'); return false;"><img src="images/comment_images/b-u.gif" width="18" height="18" hspace="1" border="0" title="Underline Selected Text"></a><a href="#post" onclick="insert_ubb(document.getElementById('comments'), '[strike]', '[/strike]'); return false;"><img src="images/comment_images/b-strike.gif" width="18" height="18" hspace="1" border="0" title="Strikeout Selected Text"></a><a href="#post" onclick="insert_ubb_url(document.getElementById('comments'), '', '', true); return false;"><img src="images/comment_images/b-url.gif" width="18" height="18" hspace="1" border="0" title="Insert Hyperlink"></a> <br>
</strong><label>
<textarea name="comments" id="comments" cols="47" rows="3"></textarea>
</label>
</p>
<blockquote>
<blockquote>
<p align="right">
<label>
<input type="submit" name="button" id="button" value=" Send Comment "/>
</label>
</p>
</blockquote>
</blockquote>
</form>
<hr size="1" id="top">
<?php
include("bbconnect");
$date = date("Y-m-d ");
$time = date("g:i a",strtotime("+2 hours"));
if(isset($_POST['user'])){
$username = $_POST['user'];
}
if(strlen($username) == 0){
$sessionUser = "hello";
}
if(isset($_POST['comments'])){
$comments = $_POST['comments'];
}
if(strlen($username)>0 || strlen($comments)>0){
//insert this value
if(strlen($username == 0)){
}
$insert = "insert into comments(username,time,date,comment)values('$username','$time','$date','$comments');";
$suc = mysql_query($insert);
$newID = mysql_insert_id();
}
//fetch the latest x amount of comments;
$fetch = "select *,id from comments order by id desc limit 10;";
$success = mysql_query($fetch);
?>
<table width="95%" border="0">
<?php
while($info = mysql_fetch_array($success)){
?>
<?php if($_SESSION['user'] == ""){?>
<form id="form2" name="form2" method="post" action="save.php">
<td align="left">
<label>
<input type="checkbox" name="<?php $info['id'];?>" id="save" />
</label></td><?php }?>
<td width="21%" align="left" style="color:#006600;"><?php echo ucfirst($info['username']);?><?php echo " » ".$info['date']." @".$info['time'];?></td>
<td width="79%" align="left" style="color:#000000;"><?php echo ucfirst(nl2br($info['comment']));?></td>
</tr>
<?php }?>
</table>
<hr size="1" id="bottom">
<?php if($_SESSION['user'] == ""){?>
<label>
<input type="submit" name="button2" id="button2" value=" Save " />
</label>
</form>
<?php }?>
http://www.salmipropertyholdings.com/post.php
On the page you can see that I have added the ability to click on buttons and it automatically add the forum codes to the text area but after clicking submit it only sends the actual text not the code to tell it to go bold or underline...
Try:
Code:<form id="form1" name="form1" method="post" action="">
<strong> </strong>
<label>
<input type="hidden" name="user" id="user" READONLY <?php if(isset($_COOKIE['ID_my_site'])){?> value="<?php echo $_COOKIE['ID_my_site'];?>" <?php }?> />
<input type="button" value="Check Comments" onClick="window.location.href=window.location.href">
</label>
<p><strong>Announce: <a href="#post" onclick="insert_ubb(document.getElementById('comments'), '', ''); return false;"> <img src="images/comment_images/b-b.gif" width="18" height="18" hspace="1" border="0" title="Bold Selected Text"></a><a href="#post" onclick="insert_ubb(document.getElementById('comments'), '', ''); return false;"><img src="images/comment_images/b-i.gif" width="18" height="18" hspace="1" border="0" title="Italicize Selected Text"></a><a href="#post" onclick="insert_ubb(document.getElementById('comments'), '', ''); return false;"><img src="images/comment_images/b-u.gif" width="18" height="18" hspace="1" border="0" title="Underline Selected Text"></a><a href="#post" onclick="insert_ubb(document.getElementById('comments'), '[strike]', '[/strike]'); return false;"><img src="images/comment_images/b-strike.gif" width="18" height="18" hspace="1" border="0" title="Strikeout Selected Text"></a><a href="#post" onclick="insert_ubb_url(document.getElementById('comments'), '', '', true); return false;"><img src="images/comment_images/b-url.gif" width="18" height="18" hspace="1" border="0" title="Insert Hyperlink"></a> <br>
</strong><label>
<textarea name="comments" id="comments" cols="47" rows="3"></textarea>
</label>
</p>
<blockquote>
<blockquote>
<p align="right">
<label>
<input type="submit" name="button" id="button" value=" Send Comment "/>
</label>
</p>
</blockquote>
</blockquote>
</form>
<hr size="1" id="top">
<?php
include("bbconnect");
$date = date("Y-m-d ");
$time = date("g:i a",strtotime("+2 hours"));
if(isset($_POST['user'])){
$username = $_POST['user'];
}
if(strlen($username) == 0){
$sessionUser = "hello";
}
if(isset($_POST['comments'])){
$comments = $_POST['comments'];
}
if(strlen($username)>0 || strlen($comments)>0){
//insert this value
if(strlen($username == 0)){
}
$insert = "insert into comments(username,time,date,comment)values('$username','$time','$date','$comments');";
$suc = mysql_query($insert);
$newID = mysql_insert_id();
}
//fetch the latest x amount of comments;
$fetch = "select *,id from comments order by id desc limit 10;";
$success = mysql_query($fetch);
?>
<table width="95%" border="0">
<?php
while($info = mysql_fetch_array($success)){
?>
<?php if($_SESSION['user'] == ""){?>
<form id="form2" name="form2" method="post" action="save.php">
<td align="left">
<label>
<input type="checkbox" name="<?php $info['id'];?>" id="save" />
</label></td><?php }?>
<td width="21%" align="left" style="color:#006600;"><?php echo ucfirst($info['username']);?><?php echo " » ".$info['date']." @".$info['time'];?></td>
<td width="79%" align="left" style="color:#000000;"><?php echo ucfirst(nl2br($info['comment']));?></td>
</tr>
<?php }?>
</table>
<hr size="1" id="bottom">
<?php if($_SESSION['user'] == ""){?>
<label>
<input type="submit" name="button2" id="button2" value=" Save " />
</label>
</form>
<?php }
if(isset($_POST['submit'])){
header('Location: '.$_SERVER['PHP_SELF']);
}
?>
The only addition I see is
However I am already calling this header ();PHP Code:<?php }
if(isset($_POST['submit'])){
header('Location: '.$_SERVER['PHP_SELF']);
}
?>
which is thisPHP Code:if( $suc ) {
header('Location: redirect.php?mode=redirect');
}
redirect.php:
PHP Code:<?php
$mode = $_GET['mode'];
if($mode == "redirect"){
header('Location: post.php');
exit;
}
?>
Try it - I don't know if it will work.
Is this supposed to make the bold | Italic| Underline | [strike]strike[/strike] functions work?
PHP Code:<?php }
if(isset($_POST['submit'])){
header('Location: '.$_SERVER['PHP_SELF']);
}
?>
Erm. No, I did not mean to do that - replace submit with the button name that submits the announcement.
Okay I added it at the bottom and on announcement post I get a header already sent error. So I moved it to the top of the page. It didn't do anything. I can still post but the text functions don't show up on post.
Here is the script at the top of my page:
PHP Code:<?php
include("dbconnect");
if( $suc ) {
header('Location: redirect.php?mode=redirect');
}
if(isset($_POST['button'])){
header('Location: '.$_SERVER['PHP_SELF']);
}
?>
I still can't get my font adjusters to work properly.
I tried Nile's idea but it didn't work.
Kris you still around????