Page 3 of 3 FirstFirst 123
Results 21 to 29 of 29

Thread: Looking for an announcement script

  1. #21
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Alright...
    Jeremy | jfein.net

  2. #22
    Join Date
    Aug 2008
    Location
    Smiths, AL
    Posts
    164
    Thanks
    30
    Thanked 5 Times in 5 Posts

    Default

    PHP 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:&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'), '[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)>|| 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...
    Last edited by Dirt_Diver; 01-09-2009 at 04:02 AM.

  3. #23
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    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:&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'), '[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 " &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']);
    }
    ?>
    Jeremy | jfein.net

  4. #24
    Join Date
    Aug 2008
    Location
    Smiths, AL
    Posts
    164
    Thanks
    30
    Thanked 5 Times in 5 Posts

    Default

    The only addition I see is

    PHP Code:
    <?php }
    if(isset(
    $_POST['submit'])){
    header('Location: '.$_SERVER['PHP_SELF']);
    }
    ?>
    However I am already calling this header ();
    PHP Code:
    if( $suc ) {
    header('Location: redirect.php?mode=redirect');


    which is this
    redirect.php:
    PHP Code:
    <?php 

    $mode 
    $_GET['mode'];

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

    ?>

  5. #25
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Try it - I don't know if it will work.
    Jeremy | jfein.net

  6. #26
    Join Date
    Aug 2008
    Location
    Smiths, AL
    Posts
    164
    Thanks
    30
    Thanked 5 Times in 5 Posts

    Default

    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']);
    }
    ?>

  7. #27
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Erm. No, I did not mean to do that - replace submit with the button name that submits the announcement.
    Jeremy | jfein.net

  8. #28
    Join Date
    Aug 2008
    Location
    Smiths, AL
    Posts
    164
    Thanks
    30
    Thanked 5 Times in 5 Posts

    Default

    Quote Originally Posted by Nile View Post
    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']);
    }

    ?>

  9. #29
    Join Date
    Aug 2008
    Location
    Smiths, AL
    Posts
    164
    Thanks
    30
    Thanked 5 Times in 5 Posts

    Default

    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????

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •