I am trying to process my form using an array. For some reason when I put a word in my form it does not process though the database. It only reads back what I type. I need it to read what I type can change to the word that is in my database.
<html>
<body>
<form action="form2.php" method="POST">
<textarea name="paragraph" rows="25" cols="100"> </textarea >
<input type=”text” name=”word” />
<input type="submit" value="submit" />
</form>
<?php
$dbhost = 'paper2010.db.7124637.hostedresource.com';
$dbuser = 'paper2010';
$dbpass = 'Lamonte24';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
$dbname = 'paper2010';
mysql_select_db($dbname);
//oldWord command
$searchArray = array("$_POST");
//now let's replace
$result = mysql_query("SELECT * FROM words WHERE NAME='$searchArray'");
while($row = mysql_fetch_array($result))
{
$show= $row['SYNONYM1'];
}
$searchArray = array("$_POST");
$replaceArray = array("$show");
$intoString = "$_POST[paragraph]";
//now let's replace
print str_replace($searchArray, $replaceArray, $intoString);
//it should print "Here is word one, as well sound two and etc three"
//$_POST['selectedwords']
?>
</body>
</html>
For some reason I can not get the value from the database.
Bookmarks