helloise Posted January 10, 2011 Share Posted January 10, 2011 the line : echo $form['catcher_id'] gives me a dropdown list which was defined in a base class as: 'catcher_id' => new sfWidgetFormPropelChoice(array('model' => 'LpmCatcher', 'add_empty' => false)),when i choose another item from the dropdown i want to do a few things but my code not working: $selected_catcher = $form['catcher_id']; foreach($selected_catcher as $val) { $catcher_name = $val->getName(); echo $catcher_name." ".$val->getId(); if ($catcher_name = "zed-catcher") { echo $form['service_code']->renderLabel(); echo $form['service_code']->renderError(); echo $form['service_code']; } }please help?thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted January 10, 2011 Share Posted January 10, 2011 You need to use "==" to compare values, the "=" operator sets a value, it does not compare. If that doesn't help, show the rest of the code. That type of code will only work if they select a value and then submit the form, but it doesn't look like you're getting the value they picked. Link to comment Share on other sites More sharing options...
helloise Posted January 11, 2011 Author Share Posted January 11, 2011 You need to use "==" to compare values, the "=" operator sets a value, it does not compare. If that doesn't help, show the rest of the code. That type of code will only work if they select a value and then submit the form, but it doesn't look like you're getting the value they picked.no i am not getting the value i picked and yes sorry it should be "==" Link to comment Share on other sites More sharing options...
justsomeguy Posted January 11, 2011 Share Posted January 11, 2011 Check here to see how to get form information using PHP:http://www.w3schools.com/php/php_forms.asp Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.