PDA

View Full Version : Looking for an announcement script



Dirt_Diver
01-06-2009, 06:50 PM
I would like to find an announcement script that would allow users to type in text then hit submit and it post right below the whole text box. I would like it to last for 10 lines before the new entry is pushes it off. However I would also like to have a radio box that allows me to save an entry so it doesn't get deleted until I uncheck it.

Can anyone help me?

l_kris06
01-06-2009, 07:12 PM
sounds straight forward,

Steps:

1. Create a form like u said input box. on the same page, collect the values
of the form by using $_POST.
2. On the same page, create a table with width set to 100% and within the
TD field use <?php if(isset($_POST['whtever_input_field_name'])){ echo
$_POST['whtever_input_field_name'];}
3. On the same page, on reception, write this value into the db with an auto
incr field, and get the last insert id for manipulation "mysql_insert_id()".
4. when new data comes in as and when user types, use a select query and
limit it by 1 to get the latest entry and repeat step2 partially.

are you looking for the entire code? or are you stuck in the process of writing one?

Dirt_Diver
01-06-2009, 07:18 PM
Well I don't know how to code it but I am still trying to learn php. I guess my first thoughts were where do I begin. I thought about creating a table in mysql that would hold the info but I wasn't sure if that's what I needed to do or not.

What I do know is I have an html page already that I would insert the code into a table on the page. So the code can't relate to anything else other than itself and well the connection to the database of course. Oh and I would need it to auto run to the next line if it runs over but not have it count as 2 lines.

Dirt_Diver
01-06-2009, 07:27 PM
Here is the page I just started for this little lesson.

http://salmipropertyholdings.com/post.php

l_kris06
01-06-2009, 07:40 PM
Mmm , so this 10 lines, you want the latest 10 posts to remain on top, with each post having a check box to it so that u can save those items and not hav them replaced with the newer ones?

can be done.

Dirt_Diver
01-06-2009, 07:45 PM
Yes, that would be perfect.

Also one more think if it's not to much to ask.

I would like it to post in this format.

User inputs:
Hi I'm Joe

php output:
Jan 6 2009 14:43 Hi I'm Joe
-------------------------------------

Also I just started working on the php and I copied what you put above and it's already working now I just need to tweek it to perfection.
I also forgot to mention that I need it to stay on the page until it is deleted so if I close the page and open it from another location I can still see it, until someone else posts to it.

l_kris06
01-06-2009, 08:20 PM
Ok, whatver you wanted is closed to completed, minus the checkbox and saving part. you can improvise, or maybe i can complete it tomorrow for you.

create a db schema :

+----------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| username | varchar(300) | YES | | NULL | |
| comment | varchar(3000) | YES | | NULL | |
| time | varchar(30) | YES | | NULL | |
| date | date | YES | | NULL | |
+----------+------------------+------+-----+---------+----------------+





<form id="form1" name="form1" method="post" action="">
<label>
<strong>Username</strong>:
<input type="text" name="user" id="user" />
</label>
<p><strong>Comments: </strong></p>
<p>
<label>
<textarea name="comments" id="comments" cols="45" rows="5"></textarea>
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
</p>
</form>

<?php

include('dbconn.php');

$date = date("Y-m-d");
$time = date("g:i a");

if(isset($_POST['user'])){
$username = $_POST['user'];
}

if(isset($_POST['comments'])){
$comments = $_POST['comments'];
}

if($username != "" || $comments !=""){

//insert this value
$insert = "insert into comments(username,time,date,comment)values('$username','$time','$date','$comments');";
$suc = mysql_query($insert);
$newID = mysql_insert_id();
}

//fetch the latest 10 comments;

$fetch = "select * from comments order by date limit 10 ;";
$suc = mysql_query($fetch);
?>
<table width="100%" style='font-size:13px;'>
<?php
while($info = mysql_fetch_array($suc)){ ?>
<tr>
<td>
<?php
echo "<b>".$info['date']." | ".$info['time']."</b>&nbsp;&nbsp;".$info['comment'];
?>
</tr>
</td>
<?php }?>
</table>

Dirt_Diver
01-06-2009, 08:59 PM
For whatever odd reason when I past in the php it throws off the entire page. The links swap sides and the table with the text fields in it disappear.

Dirt_Diver
01-06-2009, 09:09 PM
Okay NM I figured all that out,

First off let me say thank you a million times over your awesome.

Next I have a few small adjustment favors to ask of you.

1. I want to reverse the order in which the posts are displayed. Right now the latest post is on the bottom but I want to swap it to the top. How do I do this?

Also I swapped the code around some, here is the new code as it sits.


<?php
include("dbconnect");

$date = date("Y-m-d");
$time = date("g:i a");


if(isset($_POST['user'])){
$username = $_POST['user'];
}

if(isset($_POST['comments'])){
$comments = $_POST['comments'];
}

if($username != "" || $comments !=""){

//insert this value
$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 * from comments order by date limit 20;";
$suc = mysql_query($fetch);
?>
<?php
while($info = mysql_fetch_array($suc)){
?>

<?php
echo "<font color=\"#008000\">".$info['username']." -- ".$info['date']." @ ".$info['time']."</font>&nbsp;&nbsp;&nbsp;".$info['comment'];
echo "<br><br>";
?>

<?php
}
?>

l_kris06
01-07-2009, 07:52 AM
:)glad to have helped.

To get the latest posts on the top, change

Replace this:

$fetch = "select * from comments order by date limit 20;";

with :


$fetch = "select * from comments order by date desc limit 20;";

I see that you have removed the inline table for showing the comments, its always a good idea to use tables instead of break tags. when the comment characters increases, the table cell will expand, if thats your worry, you can always do a wrap. (wordwrap). Tables also come handy when u want alternate row highlight and things of that nature.

Anyways, do you still want the option to prevent posts from moving away from the display list?

Rgds,
Kris

Dirt_Diver
01-07-2009, 02:35 PM
I did remove the original table because for whatever reason it was throwing off the site css and rearranging the page. However I was able to still insert the php into another table by itself.

I searched the [acs | desc] last night but I guess out of everything else I have going on I couldn't get it to work because I was leaving the [ ] in the code. Yeah I know, I'm clueless.

Anyway, Because the page will be accessed to logged in members only and I can't get the log in's to match I have a work around patch that I would like to use instead. Right now I have it set so that if you are logged into to the site and you visit the page it automatically pastes your username into the "your name" box. However it is still editable so I would like to make the box inactive so it will still input the username but the user won't be able to change it.

Something else I noticed is that if I make a post on the page and then I refresh the page it posts the same post again. Is that a cookie that's doing that? If so can we delete only that cookie after posts? What I plan on doing is setting the page to refresh about every 10 or so seconds so it will see new posts from other members. Also *just a note* - I do have other cookies on the page that I need to keep, so if we will be deleting cookies we should name is something like commentcook or something off the wall.

Other than that, the only other thing I would like is the ability to delete the lines, but leave them on the server in case I need to double check something later in life.

Dirt_Diver
01-07-2009, 04:19 PM
Sorry but I was just thinking, if someone posts a link can we make it clickable?

l_kris06
01-07-2009, 07:02 PM
the page reloading on refresh is because, the post still resides on the page.
i fixed the code to include the checkbox for saving, and also to block the current user in the username field which remains disabled through out his login.

The save functionality is partially implemented, but whatver else u had asked is present in this code.

my assumed file name for the following code is "main.php"


<?php session_start(); ?>
<form id="form1" name="form1" method="post" action="">
<label>
<strong>Username</strong>:
<input type="text" name="user" id="user" <?php if(isset($_SESSION['user'])){?> disabled="disabled" value="<?php echo $_SESSION['user'];?>" <?php }?>/>
</label>
<p><strong>Comments: </strong></p>
<p>
<label>
<textarea name="comments" id="comments" cols="45" rows="5"></textarea>
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
</p>
</form>


<?php session_start();

include('dbconn.php');

$date = date("Y-m-d");
$time = date("g:i a");


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)){
$username = "Kris"; //point this value to use the session variable of your current user.
}
$insert = "insert into comments(username,time,date,comment)values('$username','$time','$date','$comments');";
$suc = mysql_query($insert);
$newID = mysql_insert_id();

if($suc){
$url = "redirect.php?mode=redirect";
header('Location: '.$url);
}

}


//fetch the latest x amount of comments;

$fetch = "select *,id from comments order by date limit 20;";
$success = mysql_query($fetch);
?>

<table width="100%" border="0">

<?php
while($info = mysql_fetch_array($success)){
?>
<tr>
<?php if($_SESSION['user'] == "Kris"){?>
<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 " &raquo; ".$info['date']." @".$info['time'];?></td>
<td width="79%" align="left" style="color:#000000;"><?php echo ucfirst(nl2br($info['comment']));?></td>
</tr>

<?php }?>
</table>

<?php if($_SESSION['user'] == "Kris"){?>
<label>
<input type="submit" name="button2" id="button2" value="Save" />
</label>
</form>
<?php }?>

second reference code file: redirect.php

<?php session_start();

$mode = $_GET['mode'];

if($mode == "redirect"){
header('Location: main.php');
exit;
}

?>

Play with it, you might be able to enhance it even further :)

Dirt_Diver
01-07-2009, 08:00 PM
I'm getting a can not modify header error from this.



if($suc){
$url = "redirect.php?mode=redirect";
header('Location: '.$url);
}


Well I was so I deleted it but that's what keeps me from reposting every time I hit refresh right?

Also what is the save button do? When I check a box and click it, it's sending me to save.php. I don't have a save.php (yet).

JasonDFR
01-08-2009, 08:11 AM
I'm getting a can not modify header error from this.



if($suc){
$url = "redirect.php?mode=redirect";
header('Location: '.$url);
}




You cannot use header(); after anything has been sent to the browser. In l_kris06's script, there is a bunch of html above the header(); function. Not to mention the html, head, body tags and so on that should exist on your page.

Also, this is not going to work:


//insert this value
if(strlen($username == 0)){
$username = "Kris"; //point this value to use the session variable of your current user.
}

It should be:


if ( strlen($username) == 0 ) {

l_kris06 and dirt_diver, you really should get in the habit of using tabs or spaces and line spacing in your code. Especially inside if statements. If you don't it is going to turn into a diaster once the code gets even a little more complex.

For example, the following is much better:



if ( $suc ) {

$url = "redirect.php?mode=redirect";
header('Location: '.$url);

// You could have just wrote: header('Location: redirect.php?mode=redirect'); btw

}

l_kris06
01-08-2009, 12:19 PM
Its interesting, i dont get any errors, and it works as expected here.
besides i have PHP5. not sure.

You are right here..


//insert this value
if(strlen($username == 0)){ //This needs to be if(strlen($username) == 0))
$username = "Kris"; //point this value to use the session variable of your current user.
}


The save functionality which is not done yet is basically an option where the original poster wanted some of the posts from not being replace with the newer ones. i intend to use that to mark the individual entries in the DB and
use it later for fetching


@Dirtdriver,
you can post clickable links yes but not in the code thats below. Clickable links mean inherent html tags and textarea wont help here, all my applications use "FCKeditor" whever i want user comments. Take a look on the front, its easy to implement here too.

Dirt_Diver
01-08-2009, 02:53 PM
Okay I have changed the header (); to


if( $suc ) {
header('Location: redirect.php?mode=redirect');

}


And I last night I moved it above the html tags because I was getting the header already sent error.

Still getting the double posts though. I would assume that the header is supposed to fix that but I don't know if it is. I changed the address from redirect to a page I don't have and I don't see a difference so I'm thinking something isn't working right.

Kris thanks again so much for your help on this.

Dirt_Diver
01-08-2009, 08:27 PM
Okay I have added some .js to the mix to allow users to click on a picture and it enter in forum codes like {b} and {i} but how do I get php to see it and produce it on submit?

Nile
01-09-2009, 03:08 AM
Nah, just do something like this:


<?php session_start(); ?>
<form id="form1" name="form1" method="post" action="">
<label>
<strong>Username</strong>:
<input type="text" name="user" id="user" <?php if(isset($_SESSION['user'])){?> disabled="disabled" value="<?php echo $_SESSION['user'];?>" <?php }?>/>
</label>
<p><strong>Comments: </strong></p>
<p>
<label>
<textarea name="comments" id="comments" cols="45" rows="5"></textarea>
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
</p>
</form>


<?php session_start();

include('dbconn.php');

$date = date("Y-m-d");
$time = date("g:i a");


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)){
$username = "Kris"; //point this value to use the session variable of your current user.
}
$insert = "insert into comments(username,time,date,comment)values('$username','$time','$date','$comments');";
$suc = mysql_query($insert);
$newID = mysql_insert_id();

if(isset($_POST['button2']) || isset($_POST['button'])){
header('Location: '.$_SERVER['PHP_SELF']);
}

}


//fetch the latest x amount of comments;

$fetch = "select *,id from comments order by date limit 20;";
$success = mysql_query($fetch);
?>

<table width="100%" border="0">

<?php
while($info = mysql_fetch_array($success)){
?>
<tr>
<?php if($_SESSION['user'] == "Kris"){?>
<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 " &raquo; ".$info['date']." @".$info['time'];?></td>
<td width="79%" align="left" style="color:#000000;"><?php echo ucfirst(nl2br($info['comment']));?></td>
</tr>

<?php }?>
</table>

<?php if($_SESSION['user'] == "Kris"){?>
<label>
<input type="submit" name="button2" id="button2" value="Save" />
</label>
</form>
<?php }?>

Dirt_Diver
01-09-2009, 03:37 AM
I don't see your changes but let me get the newest code so we are working on the same level. brb.

Nile
01-09-2009, 03:45 AM
Alright... :)

Dirt_Diver
01-09-2009, 03:56 AM
<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:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<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'), '', ''); 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 " &raquo; ".$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 }?>

BTW if you want o visually see the page it's located at
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...

Nile
01-09-2009, 04:13 AM
Try:


<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:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<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'), '', ''); 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 " &raquo; ".$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']);
}
?>

Dirt_Diver
01-09-2009, 04:30 AM
The only addition I see is


<?php }
if(isset($_POST['submit'])){
header('Location: '.$_SERVER['PHP_SELF']);
}
?>

However I am already calling this header ();

if( $suc ) {
header('Location: redirect.php?mode=redirect');

}

which is this
redirect.php:

<?php

$mode = $_GET['mode'];

if($mode == "redirect"){
header('Location: post.php');
exit;
}

?>

Nile
01-09-2009, 12:55 PM
Try it - I don't know if it will work.

Dirt_Diver
01-09-2009, 08:33 PM
Is this supposed to make the bold | Italic| Underline | strike functions work?


<?php }
if(isset($_POST['submit'])){
header('Location: '.$_SERVER['PHP_SELF']);
}
?>

Nile
01-09-2009, 08:41 PM
Erm. No, I did not mean to do that - replace submit with the button name that submits the announcement.

Dirt_Diver
01-09-2009, 08:50 PM
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
include("dbconnect");

if( $suc ) {
header('Location: redirect.php?mode=redirect');

}

if(isset($_POST['button'])){
header('Location: '.$_SERVER['PHP_SELF']);
}

?>

Dirt_Diver
01-13-2009, 12:15 PM
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????