messer Posted May 7, 2009 Share Posted May 7, 2009 I have an dynamic row,that can be duplicated as many times as i want : .... <tr > <td class="txt_rapport" ><input name="pos[]" type="text" size=5 /></td> <td class="txt_rapport" >' ;?> <? echo menu_select();?> <? echo'</td> <td class="txt_rapport" >' ;?> <? echo bon_select();?> <? echo'</td> <td class="txt_rapport" ><input name="nrl[]" type="text" size=5 /></td> </tr> '; <p><div align="left"> <a href="javascript://" onClick="new_row()"><input type="button" value="Add Article"></a><div> <div align="right"><a href="javascript://" onClick="delete_row()"><input type="button" value="Delete Article"></a><div></p> ... <div align="center"><input name="submit" type="submit" value=" Next " /><div> </form> '; break; case'rapport': if(!isset($_POST['pos'])) $_SESSION['pos'] = ''; else $_SESSION['pos'] = $_POST['pos']; if(!isset($_POST['bon'])) $_SESSION['bon'] = ''; else $_SESSION['bon'] = $_POST['bon']; if(!isset($_POST['aticles'])) $_SESSION['aticles'] = ''; else $_SESSION['aticles'] = $_POST['aticles']; if(!isset($_POST['nr'])) $_SESSION['nr'] = ''; else $_SESSION['nr'] = $_POST['nr']; .... And here is my problem, I don't know how to arrange those arrays in such a way that each value to be correct arranged... I've tried something like this but it doesn't arrange correctly : ..... rsort($_SESSION['pos'],SORT_STRING); rsort($_SESSION['bon']); rsort($_SESSION['nr']); $check=0; foreach($_SESSION['bon'] as $key=>$value) { $query_art="SELECT * FROM articles WHERE ArtID='".$_SESSION['articles'][$key]."'"; $result_art=mysql_query($query_art); $Row_art = mysql_fetch_array ($result_art); if ($check != $_SESSION['bon'][$key]) { $query_bon="SELECT * FROM bon WHERE ID='".$_SESSION['bon'][$key]."'"; $result_bon=mysql_query($query_bon); $Row_bon = mysql_fetch_array ($result_bon); echo' <tr > <td class="txt_rapport" colspan=4><b>bon:</b>'.$Row_bon['BonNumer'].' ( '.$Row_bon['BonDatum'].')</td> </tr> <tr> <td class="txt_rapport" align="right">'.$_SESSION['pos'][$key].'</td> <td class="txt_rapport" align="left"> '.$Row_art['Teilnumer'].'</td> <td class="txt_rapport" align="left"> '.$Row_art['Art_Description'].'</td> <td class="txt_rapport">'.$_SESSION['nr'][$key].'</td>'; echo' </tr>'; }else { echo' <tr> <td class="txt_rapport" align="right">'.$_SESSION['pos'][$key].'</td> <td class="txt_rapport" align="left"> '.$Row_art['Teilnummer'].'</td> <td class="txt_rapport" align="left"> '.$Row_art['Art_Description'].'</td> <td class="txt_rapport">'.$_SESSION['nr'][$key].'</td>'; echo' </tr>'; } $check=$_SESSION['bon'][$key]; } ...... Please some one to help me pls... Quote Link to comment https://forums.phpfreaks.com/topic/157230-array-probems/ Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 Define "arrange correctly." Quote Link to comment https://forums.phpfreaks.com/topic/157230-array-probems/#findComment-828459 Share on other sites More sharing options...
messer Posted May 7, 2009 Author Share Posted May 7, 2009 Sorry, i don't understand you , could you explain please? Quote Link to comment https://forums.phpfreaks.com/topic/157230-array-probems/#findComment-828460 Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 No, it's the other way around. I don't understand you. Could you explain what you mean by arrange correctly? If I have numbers 1,2,3,4,5 and I ask you to arrange them correctly, that wouldn't make sense unless I tell you how I want them to be arranged. Now, it's your turn. Please explain arrange correctly. Quote Link to comment https://forums.phpfreaks.com/topic/157230-array-probems/#findComment-828464 Share on other sites More sharing options...
messer Posted May 7, 2009 Author Share Posted May 7, 2009 oh, sorry , just one minute... Quote Link to comment https://forums.phpfreaks.com/topic/157230-array-probems/#findComment-828473 Share on other sites More sharing options...
messer Posted May 7, 2009 Author Share Posted May 7, 2009 Here is my dynamic row: .... <tr> <td>$valueX[]</td> <td>$valueY[]</td> <td>$valueZ[]</td> <td>$valueW[]</td> </tr> <tr> <td>$valueX[]</td> <td>$valueY[]</td> <td>$valueZ[]</td> <td>$valueW[]</td> </tr> <tr> <td>$valueX[]</td> <td>$valueY[]</td> <td>$valueZ[]</td> <td>$valueW[]</td> </tr> .... And after i press NEXT these arrays are goind to under case'rapport': Quote Link to comment https://forums.phpfreaks.com/topic/157230-array-probems/#findComment-828480 Share on other sites More sharing options...
messer Posted May 7, 2009 Author Share Posted May 7, 2009 .... <tr> <td>$valueX[]</td> <td>$valueY[]</td> <td>$valueZ[]</td> <td>$valueW[]</td> </tr> <tr> <td>$valueX[]</td> <td>$valueY[]</td> <td>$valueZ[]</td> <td>$valueW[]</td> </tr> <tr> <td>$valueX[]</td> <td>$valueY[]</td> <td>$valueZ[]</td> <td>$valueW[]</td> </tr> .... And I want to arrange in such way : for example all values from the 3rd row then values from then 1st row the value from then 2nd row, and each time it can be different, so , to arrange them also dynamicaly, but values to corespond from their original row... Now i hope that you understand me.... Quote Link to comment https://forums.phpfreaks.com/topic/157230-array-probems/#findComment-828507 Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 I think you need JavaScript and possibly AJAX. Quote Link to comment https://forums.phpfreaks.com/topic/157230-array-probems/#findComment-828517 Share on other sites More sharing options...
messer Posted May 7, 2009 Author Share Posted May 7, 2009 :( :'( :'(:'( I don't know java and ajax the same Quote Link to comment https://forums.phpfreaks.com/topic/157230-array-probems/#findComment-828520 Share on other sites More sharing options...
messer Posted May 7, 2009 Author Share Posted May 7, 2009 Maybe there are another ways to do it in php??? anyone,could give me an idea please??? Quote Link to comment https://forums.phpfreaks.com/topic/157230-array-probems/#findComment-828614 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.