User: <input type="text" name="username">
Password:<input type="password" name="password">
Search for: <input type="text" name="search">
<input type="submit" name="submit" value ="Search">
</form>
//search.php
If ($_POST[submit] {
mysql_connect("mysql"- $user- $pass)
Or die(mysql_error());
echo "<p>Thanks for using PowerSearch. Your search results for <b>$_POST[search]</b> are: </p>";
mysql_select_db("Country");
$query = "select * from Articles where Author like %$_POST[search]% ";
$result = mysql_query($query);
echo "<table width= 600 border= 1 cellpadding= 5 ><tr>";
echo "<th align= left width= 200 >Title</th><th align= left width= 100 >Author</th><th align= left width= 200 >Content</th>
<th align= left width= 100 >Date</th></tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr><td>".$row[0]."</td>";
echo "<td>".$row[1]."</td>";
echo "<td>".$row[2]."</td>";
echo "<td>".$row[3]."</td></tr>";
}
echo "</table>";
}
?>
so the form is to check for the username and password. Once that is done- the user should be directed to another form that would invoke the php search engine script. I learnt that i could user form hidden fields to save the search strings from the first form and use them in the second but i dont know how to do that. do you?:-)
i tried the header(); function but didnt work either.
colanth- thanks for sending me to chapter 9 in my book :-)
session variables and cookies :-)
ADD:
Andrei- thanks a lot man. I tried the script just as is- i.e.
<?php
header("Location: http://www.mysite.com/search.html");
?>
and it worked fine. I have reworked the script and posted it here:
i would appreciate if you could look at it and let me know what you think is the problem. It just doesnt work. I think i prefer the header function to sessions and hidden fileds). Thanks a lot.
Andrei- great work- the mystery is finally solved- thanks- man.
apache vrs. 2.2.8
php vrs. 5.2.6
mysql vrs. 5.0.51b
I m trying to see how much time and resources a page takes up on my server. It contains php and mysql functions. Can I find out somehow?
i jut wanted to know some general info on the two languages- what they re good at / bad at. stuff like that.
i intend to learn php / mysql but i wanted to learn another language also- and i WAS recommended python- but django caught my eye somehow. from what i can tell its just a shorctt system for python- but thats why i want some more info.
anything would be appreciated :P thanks.
thanks for the answer but i prefer to avoid the .NET languages- i have several reasons for this namely
1: I d be forced to use a windows server if i went with one of those- and they not only cost more- but aren t as good imo
2: i just don t like the .net languages- i ve played before and its just.. bleh.
3: they mess about with the API too much- you buy a book or something on learning the language within 1 month they ve changed half the API so it doesn t work anymore.
after doing a little more research django is just a template language for python (which isn t a bad thing)
if anyone knows any other free opensource etc languages along the lines of pythong which have different plusses then let me know the differences / benefits of one over the other.
ok guru wins best answer- i ll be popping up anothe rquestion soon based on his answer though.
No comments:
Post a Comment