/    Sign up×
Community /Pin to ProfileBookmark

Hi All,

The weathers dull, its raining again, England lost, WHAT NEW. Good luck Portugal.

My Problem.

I have a form with a selection dropdown menu on it. when I select an option and click on the submit button (Button Lable “Category”) the from action calls a PHP script. The script return NO DATA. If I run the PHP script standalone it returns data. So I think it is my form that is the problem.

THE FORM:

<form action=”category_search.php” method=”post” name=”category” target=”_self” class=”bodytext” id=”category”>
<table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td width=”57%” class=”bodytext”><div align=”right” class=”producttitle”>Select
</div></td>
<td width=”16%”><div align=”right”>
<select name=”category” class=”bodytext” id=”category”>
<option value=”LIM”>Library and Information Management</option>
<option value=”KM”>Knowledge Management </option>
<option value=”IP”>Intellectual Property</option>
<option value=”CON”>Construction</option>
</select>
</div></td>
<td width=”27%”><div align=”right”>
<input name=”category” type=”submit” class=”formcolheadersmall” id=”category” value=”Category”>
</div></td>
</tr>
</table>
</form>

END FORM

For reference the PHP/SQL script (part) is below.

[code=php]<?php
$colname_category_search = “1”;
if (isset($_POST[‘category’])) {
$colname_category_search = (get_magic_quotes_gpc()) ? $_POST[‘category’] : addslashes($_POST[‘category’]);
}
mysql_select_db($database_Chandos, $Chandos);
$query_category_search = sprintf(“SELECT * FROM chandos_books WHERE category = ‘%s'”, $colname_category_search);
$category_search = mysql_query($query_category_search, $Chandos) or die(mysql_error());
$row_category_search = mysql_fetch_assoc($category_search);
$totalRows_category_search = mysql_num_rows($category_search);
?>[/code]

Can anyone see what the problem is. I have been messing about with this all day.

Kind regards. keep safe and well.

Dereck

to post a comment
HTML

0Be the first to comment 😎

×

Success!

Help @dcjones spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...