raman Posted May 5, 2009 Share Posted May 5, 2009 I have a html page with three checkboxes to which I have given different names and different values 0, 1 and 2. $hybpred=$_POST['hybpred']; $sscpred=$_POST['sscpred']; $pfams=$_POST['pfam']; function get_svm_result($randi,$sqfile,$sscthresh,$hybthresh,$pthresh){ $str=array(); if ($sscpred==1){ $strategy_name='Secondary Structure Composition'; array_push($str, $strategy_name); } if ($hybpred==0){$strategy_name='PSSM+SSC hybrid model '; array_push($str, $strategy_name);} if ($pfam==2){$strategy_name='Pfam prediction'; array_push($str, $strategy_name);} } echo "<TR><TD width=30%><font size=4><b>Prediction Strategy</TD><TD width=5%>:<TD>";foreach($str as $fdr){echo "$fdr ";}echo"</TD>"; But when wish to echo two or three elements of the array $str when the user selects two or three, I get only one element of the array. Please suggest why it's happening. Link to comment https://forums.phpfreaks.com/topic/156895-solved-array-push/ Share on other sites More sharing options...
whizzopia Posted May 5, 2009 Share Posted May 5, 2009 There's nothing wrong with the array_push. Maybe there's something wrong with the argument that you pass to the get_svm_result. Link to comment https://forums.phpfreaks.com/topic/156895-solved-array-push/#findComment-826539 Share on other sites More sharing options...
sasa Posted May 5, 2009 Share Posted May 5, 2009 look variable scope variables $hybpred, $sscpred and $pfams don't exist inside function and variable $str don't exist outside Link to comment https://forums.phpfreaks.com/topic/156895-solved-array-push/#findComment-826575 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.