Form Submission using post not working
-
Hi Guys,
I am using php exec to run php in a page.
I am a trying to create a form to connect to my database and return results.
I can do all of this fine manually in the code, my problem comes in when I try to use a form to get the text to search for. I can create the form fine, but it doesn’t work when I use action=’post’.
1. I have gotten it to kind of work with the ‘GET’ method, why isn’t post working?
2. It appears that the line LIKE ‘%$find%'” is whats keeping this from working. If I manually enter something in like ‘test’ it works fine.
I am so close.. any help is appreciated!
`<form name=”search” action=”https://www.hidden*.com/” method=”GET”>
Search for: <input type=”text” name=”find” />
<input type=”submit” name=”search” value=”Search” />
</form><?php
// Get the search variable from URL
$find = @$_GET[‘find’] ;
// We preform a bit of filtering
$find = strtoupper($find);
$find = strip_tags($find);
$find = trim ($find);// Otherwise we connect to our Database
mysql_connect(“localhost”, “hidden*”, “hidden*”) or die(mysql_error());
mysql_select_db(“hidden*”) or die(mysql_error());//Now we search for our search term, in the field the user specified
$result= mysql_query(“SELECT * FROM rpo WHERE hidden* LIKE ‘%$find%'”);// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo $row[‘rpo_code’];
echo $row[‘description’];
}?>`
- The topic ‘Form Submission using post not working’ is closed to new replies.