natasha23 Posted March 5, 2010 Share Posted March 5, 2010 Hi i am trying to get my search form to work for my database but nothing is displaying, not even the form. It works shows if i just have it as a HTML table. Can someone please tell me where i am going wrong? thanks echo '<form name="shape Test" method="post" action="<'?=$PHP_SELF?'>">'; echo "Seach for: <input type="text" name="find" /> in"; echo "<Select NAME="field">"; echo "<Option VALUE="$Row['colour']">colour</option>"; echo "</Select><input type="hidden" name="searching" value="yes" /><input type="submit" name="search" value="Search" />"; echo "</form>"; (I have the connection to my database above this bit of code.) Link to comment https://forums.phpfreaks.com/topic/194200-search-forms-with-sql/ Share on other sites More sharing options...
kavisiegel Posted March 5, 2010 Share Posted March 5, 2010 Ok, I'll go line by line. I don't know what you're trying to accomplish in this line, you probably got a couple things mixed up. echo '<form name="shape Test" method="post" action="<'?=$PHP_SELF?'>">'; // Error on a couple different levels echo '<form name="shape Test" method="post" action="'.$PHP_SELF.'">'; // Properly escaped On your lines after that, you have some escaping errors. If you use double quotes in the php, use single quotes in the HTML, or escape them. echo "Seach for: <input type="text" name="find" /> in"; // This is an error echo "Seach for: <input type=\"text\" name=\"find\" /> in"; // This is escaped echo "Seach for: <input type='text' name='find' /> in"; // This uses single quotes On the line that you deal with color, you didn't use an assignment operator: echo "<Option VALUE="$Row['colour']">colour</option>"; // Error echo "<Option VALUE=".$Row['colour'].">colour</option>"; // OK in php, not OK in HTML echo "<Option VALUE='".$Row['colour']."'>colour</option>"; // Shows a single quote in HTML, and is ok in PHP with the double quotes and assignment operator On the following lines, just fix your escaping, and then post your code back here if it still doesn't work. Link to comment https://forums.phpfreaks.com/topic/194200-search-forms-with-sql/#findComment-1021750 Share on other sites More sharing options...
natasha23 Posted March 5, 2010 Author Share Posted March 5, 2010 Thank you it now prints, i also forgot select before the option! thanks again for your help and helping me understand where i went wrong Link to comment https://forums.phpfreaks.com/topic/194200-search-forms-with-sql/#findComment-1021759 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.