php function and form
hi i was wondering where in my script there's an error.
<form name="search" method="get" action="foobar.php?action=humbug">
<input id="title_search" name="title_search" type="text"></br></br>
<input type="submit" value="Search!">
if i make the action to foobar.php AND write the php script not as a function it works. what am i doing wrong?
mysql_connect("","","") or die(mysql_error());
mysql_select_db("") or die(mysql_error());
$result=mysql_query("SELECT * FROM ml WHERE title LIKE '%$title_search%'");
echo "<tr><td class='title'>";
echo "</td><td class='year'>";
echo "</td><td class='view'>";
Are you calling the function in your file?
A function only gets processed when it is called. Simply calling a script that has a function definition in it will not fire off that function. (For that matter, if that is all the "foobar.php" script does, then there is no real reason to put it into a function.)
If you have a reason to put the functionality in a function, then you would have to do something like:
// blah blah blah . . .
// invoke it:
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
foobar.php is a file with many php functions.
when i submit the form in foobar.html. i want to run a specific function known as function humbug() in foobar.php.
how do i do that?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)