Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

function

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

function

Postby xlordt » Wed Feb 26, 2003 8:38 am

Ok i created a function called smiles.. and inside the function it has 2 arrays here is the code...

Code: Select all
function phpblock_getsmiles($smiles)
{
   $face = array(":D", ":)");
   $img = array (
             "<img align=absmiddle src='images/smilies/biggrin.gif' alt='Big Grin'>",
          "<img align=absmiddle src='images/smilies/smile.gif' alt='Smile'>" );
         
      $smiles = str_replace( $face, $img, $smiles );
      return $smiles;    
}



now my problem is that the images are no showing up in the forum post..

this is what i have for my other script...

(btw this is a memo script)
Code: Select all

//Once Submited insert in to db

 $memo = phpblock_getsmiles($_POST['memo']);
 $memo = $_POST['memo'];
 $sender = $_USER['username'];
 
 $date = date("D dS M,Y");
 $time = time("h:i a");
 
 $sql = "INSERT INTO gl_memo(id, sender, username, memo, date) VALUES ('$id','$sender', '$username',
         '$memo', '$date')";
 $result = mysql_query($sql) or die(mysql_error());
 echo '<CENTER><FONT face=\"verdana\"><br><Br> Memo has been sent  ' . $username;
  echo '<meta http-equiv="refresh" content="1;url=http://www.h4ckerx.net">';
 
 }else{
 
// Now lets show the form
?>
        <html>
      <body>
        <TABLE WIDTH="75%" align=center border=0><TR ><TD >

      <FORM METHOD="post" ACTION="<?php $PHP_SELF ?>">
      
      </font>
       From: &<b> <?php echo $_USER['username']; ?>
      </b><br>
      </td></tr>
      <tr>
      <td>Send Memo to :&
       <INPUT TYPE="text" NAME="username" VALUE="<?php echo $_GET['to']; ?>"><?php $username ?></td></tr>
      <BR><tr><td>
      <br></td></tr><tr><td>
      Messege: <br></td></tr>
      <tr wrap><td colsspan="2" wrap>
       <TEXTAREA ROWS="10" COLS="65"  NAME="memo"  wrap=physical VALUE="<?php $_POST['memo']; ?>"></TEXTAREA></td></tr><br><tr><br><td div align="left">
      <INPUT TYPE="submit" NAME="submit" ALT="submit" value="submit">
      </TD></TR></FORM></TABLE>
      </body>
      </html>
      
<?php      
   }
echo COM_sitefooter(true);
?>


now this has noting to do with the db cause the smiles are not in the db.. but.. how do i make it show in a post? once submited i want it to replace ' :) ' with its image
but i cant seem to get it to work =(
:D <---- like that
User avatar
xlordt
New php-forum User
New php-forum User
 
Posts: 34
Joined: Thu Dec 12, 2002 9:00 pm
Location: NJ

Postby Romantik » Thu Feb 27, 2003 1:00 am

Save in your base link to your icons
Romantik
New php-forum User
New php-forum User
 
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson


Return to PHP coding => General

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.