Schlo_50 Posted June 2, 2008 Share Posted June 2, 2008 Hi guys, If there a way to say in php, if 'A' equals 'B' then don't display that row? I have a select box with the options generated using a loop and I don't want duplicate options to be displayed. So if $name equals $manname I don't want that row of data to be executed in my loop. $get = $_GET['pid']; $name = $_GET['name']; print "<select name=\"manufacturer\" class=\"form\">"; print "<option value=\"$get$name\" selected=\"selected\">$name</option>"; $linesb = file("data/manufacturers.DAT"); foreach ($linesb as $lineb) { $datab = explode("|", $lineb); $mid = trim($datab[0]); $manname = trim($datab[1]); print "<option value=\"$mid$manname\">$manname</option>"; } print "</select>"; Thanks in advance for any help! Link to comment https://forums.phpfreaks.com/topic/108346-solved-select-box/ Share on other sites More sharing options...
Dathremar Posted June 2, 2008 Share Posted June 2, 2008 Just add that condition if "A" <> "B" before the printing of the option. So if they are <> from each other it will print if not then it won't. Hope I understand what you want to do Post if u need something different Link to comment https://forums.phpfreaks.com/topic/108346-solved-select-box/#findComment-555457 Share on other sites More sharing options...
Schlo_50 Posted June 2, 2008 Author Share Posted June 2, 2008 Thanks! Just the logic im looking for. Link to comment https://forums.phpfreaks.com/topic/108346-solved-select-box/#findComment-555462 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.