добрый день. я создаю поиск страницу на php результат которой должен выводиться в другом окне в отформатированную таблицу, вот так должно выглядеть:
http://antonymer.web.surftown.se/wordpage.php
помогите воплотить в жизнь пожста
код поиска:
<?php
if(isset($_POST['submit'])){
if(isset($_GET['go'])){
if(preg_match("/^[ a-zA-Z]+/", $_POST['name'])){
$name=$_POST['name'];
//connect to the database
$db=mysql_connect ("localhost", "user", "password") or die ('I cannot connect to the database because: ' . mysql_error());
//-select the database to use
$mydb=mysql_select_db("database");
//-query the database table
$sql = "select SearchWord, SynonymsFirst, SynonymsSecond, SynonymsThird, SynonymsFourth, SynonymsFifth, SynonymsSixth, SynonymsSeventh, SynonymsEight, SynonymsNinth, SynonymsTenth, SynonymsEleventh, SynonymsTwelvth from synonyms WHERE `SearchWord` LIKE '" .$name . "'";
//-run the query against the mysql query function
$result=mysql_query($sql);
//-create while loop and loop through result set
while($row=mysql_fetch_array($result)){
$SearchWord=$row['SearchWord'];
$SynonymsFirst=$row['SynonymsFirst'];
$SynonymsSecond=$row['SynonymsSecond'];
$SynonymsThird=$row['SynonymsThird'];
$SynonymsFourth=$row['SynonymsFourth'];
$SynonymsFifth=$row['SynonymsFifth'];
$SynonymsSixth=$row['SynonymsSixth'];
$SynonymsSeventh=$row['SynonymsSeventh'];
$SynonymsEight=$row['SynonymsEight'];
$SynonymsNinth=$row['SynonymsNinth'];
$SynonymsTenth =$row['SynonymsTenth '];
$SynonymsEleventh=$row['SynonymsEleventh'];
$SynonymsTwelvth=$row['SynonymsTwelvth'];
//-display the result of the array
echo "\n";
echo "<b>" .$SearchWord . "</b>" ,"<br>\n";
echo "<br>\n";
echo $SynonymsFirst . "<br>\n";
echo $SynonymsSecond . "<br>\n";
echo $SynonymsThird . "<br>\n";
echo $SynonymsFourth . "<br>\n";
echo $SynonymsFifth . "<br>\n";
echo $SynonymsSixth . "<br>\n";
echo $SynonymsSeventh . "<br>\n";
echo $SynonymsEight . "<br>\n";
echo $SynonymsNinth . "<br>\n";
echo $SynonymsTenth . "<br>\n";
echo $SynonymsEleventh . "<br>\n";
echo $SynonymsTwelvth . "<br>\n";
}
}
else{
echo "<p>Please enter a search query</p>";
}
}
}
mysql_free_result($result);
mysql_close($db);
?>