PHP search & replace from index.php text boxes?

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
johnj
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Mon Sep 17, 2012 11:05 pm

if you do not want to use str_replace then you should see if pattern matching regular expressions will help you. Here is an article that may help you -
http://phillipnb.wordpress.com/2011/03/ ... ns-part-1/

kyle04
New php-forum User
New php-forum User
Posts: 94
Joined: Sat Jul 07, 2012 1:36 pm

Tue Sep 18, 2012 1:57 am

So you will have many pages in the format www.domain.com/index.php?pagename=x ?
With the variable text different for each pagename (x), or whatever the parameter name is.
If so you could use a database table to store the different text values for each pagename, then reference the relevent text from the current url :

Table fields :
PAGENAME
TEXT

<?
foreach($_REQUEST as $name=>$value) {
${$name} = $value;
}

$result = mysql_query("SELECT TEXT FROM TABLE_PAGES WHERE PAGENAME='$pagename'");
$row = mysql_fetch_array($result);
$thistext = $row['TEXT'];

?>

// text box display

<input type="text" value="<?echo $thistext;?>" >

Post Reply