Flurry Posted December 23, 2010 Share Posted December 23, 2010 This is the first time i'm using HTML_Quickform to set up the forms on a website of mine. It seems pretty simple but i have a problem that puzzles me. Im guessing the solution is pretty simple but i just dont see it. So what is my problem? Underneath is my code. Like this it does not show the $_POST variables. Earlier i made a small mistake and the commented code was uncommented. Now i had two search buttons but to my surprise both buttons worked. It seems that as long as i add my button as seperate element and not in the group my code works fine. But i want to add the button to the group so they are aligned next to each other instead of underneath each other. Anyone any idea what i am doing wrong? require_once('HTML/QuickForm.php'); require_once('HTML/QuickForm/Renderer/Tableless.php'); function do_search() { print_r($_POST); } $form = new HTML_QuickForm('search_form','',$_SERVER['REQUEST_URI']); $renderer = new HTML_QuickForm_Renderer_Tableless(); $form->addElement('html','<p><b>Search for articles</b></p>'); $years = array('2007','2008','2009','2010','2011'); $tours = array('tour1', 'tour2', 'tour3'); $types = array('type1', 'type2', 'type3'); $name[] = &HTML_QuickForm::createElement('select','year','',$years); $name[] = &HTML_QuickForm::createElement('select','tour','',$tours); $name[] = &HTML_QuickForm::createElement('select','type','',$types); $name[] = &HTML_QuickForm::createElement('button','search','Search', array ( 'class' => 'button', "onClick" => "submit_form('content','/content/news.php','search_form',false,'content');" )); $form->addGroup($name,'data','',''); /* $form->addElement('button','search','Search', array ( 'class' => 'button', "onClick" => "submit_form('content','/content/news.php','search_form',false,'content');" )); */ echo "<div id='loading'></div>"; $form->accept($renderer); echo $renderer->toHtml(); if (isset($_POST['search'])) { if (false==$form->validate()) { echo "<div id='loading'></div>"; } else { $form->process('do_search'); } } Link to comment https://forums.phpfreaks.com/topic/222496-html_quickform-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.