supanoob Posted June 25, 2007 Share Posted June 25, 2007 ok so ima having abit of trouble with functions i have 2 functions 1 to change 1 set of strings into another and another one to reverse the process. now the first one works fine its the reversal that doesnt work. Below is a copy of both functions. the first one reverses a textarea input and the second one is meant to reverse the data in my $about_me field in the database. Function 1 - Reversing the textarea: <?php function account ($account) { $account=htmlspecialchars($account); $account=str_replace (array('[', ']', 'url=', '/url', 'img=', 'post id=', '/post', 'font=', '/font', 'left', '/left', 'center', '/center', 'right', '/right', '', '', ':scared:', '', ':roll:', ':mad:', ':love:', '', ':S'), array('<', '>', 'a href=link_out.php?link=', '/a', 'img src=', 'a href=view_post.php?post_id=', '/a', 'font color=', '/font', 'p align=\"left\"', '/p', 'p align=\"center\"', '/p', 'p align=\"right\"', '/p', '<img src=\"/images/forum/wink.gif\">', '<img src=\"/images/forum/tongue.gif\">', '<img src=\"/images/forum/scared.gif\">', '<img src=\"/images/forum/sad.gif\">', '<img src=\"/images/forum/roll.gif\">', '<img src=\"/images/forum/mad.gif\">', '<img src=\"/images/forum/love.gif\">', '<img src=\"/images/forum/happy.gif\">', '<img src=\"/images/forum/confused.gif\">'), $account); return nl2br($account); } ?> Function 2 - Reversing Function 1 <?php function account_reverse ($about_me) { $about_me=htmlspecialchars($about_me); $about_me=str_replace (array('<', '>', 'a href=link_out.php?link=', '/a', 'img src=', 'a href=view_post.php?post_id=', '/a', 'font color=', '/font', 'p align=\"left\"', '/p', 'p align=\"center\"', '/p', 'p align=\"right\"', '/p', '<img src=\"/images/forum/wink.gif\">', '<img src=\"/images/forum/tongue.gif\">', '<img src=\"/images/forum/scared.gif\">', '<img src=\"/images/forum/sad.gif\">', '<img src=\"/images/forum/roll.gif\">', '<img src=\"/images/forum/mad.gif\">', '<img src=\"/images/forum/love.gif\">', '<img src=\"/images/forum/happy.gif\">', '<img src=\"/images/forum/confused.gif\">'), array('[', ']', 'url=', '/url', 'img=', 'post id=', '/post', 'font=', '/font', 'left', '/left', 'center', '/center', 'right', '/right', '', '', ':scared:', '', ':roll:', ':mad:', ':love:', '', ':S'), $about_me); return nl2br($about_me); } ?> i have tried changing the $about_me to the textarea name and that didnt work. Quote Link to comment Share on other sites More sharing options...
trq Posted June 25, 2007 Share Posted June 25, 2007 Is your code really formatted in such a way? Why all on one line? Quote Link to comment Share on other sites More sharing options...
supanoob Posted June 25, 2007 Author Share Posted June 25, 2007 it isnt in the pspad this is how it copied over >< Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.