Jump to content

Rita_Ruah

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by Rita_Ruah

  1. Oh sorry, my bad, ok, I'm going to try to explain again: Currently, my pagination works fine (next - previous - first page - last page), but the problem is that I need to only show 5 numbers (five pages at once, and currently I am showing every page). What I want is showing every page buuuuut make sure that there are only 5 pages at once, thus the example (imagine that there is a total of 7 pages in the pagination: If I am at page 1 I will see: [1] 2 3 4 5 If I am at page 2 I will see: [2] 3 4 5 6 If I am at page 3: [3] 4 5 6 7 If I am at page 4: 3 [4] 5 6 7 Did you understand? (Sorry I am italian)
  2. for($i = $_GET['page']; $i <= $number_pages; $i++) { //Maybe this? //Please help or explain the logic of what to do, the rest i will be capable to do. //Sorry }
  3. Hi there, I know what it does, for i equals 1, while i is lower or equals number_pages, etc etc... But I am not sure what to do here, can you give me a hint? Please, I am stuck here for hours... Thanks!
  4. Hello, I have manually created a simple pagination function, but unfortunately, I am having trouble when it comes to limit the number of pages shown... At the present, If there are 10 pages, I show all the pages, but my goal was to only show 5 pages... Example: If I am on page 1 I only see: [1] 2 3 4 5 If I am on two: [2] 3 4 5 6 If I am on three: [3] 4 5 6 7 What should I do? this is my current cycle: if($number_pages > $num_pages_list /*5 in this case*/) { for($i=1; $i <= $number_pages; $i++) { if($i == $_GET['page']) { echo '<a href="'.$page.'?page='.$i.'&i='.($results_page*$i-$results_page).'"><b>'.$i.'</b></a>'; }else{ echo '<a href="'.$page.'?page='.$i.'&i='.($results_page*$i-$results_page).'">'.$i.'</a>'; } } } In this example I still show every page...
  5. Thank you! And can you please give me an simple tutorial into making this idea into areality?
  6. Once again, thanks for your help, I feel that you are pointing me in the right direction! So I need: $alpha = range('A', 'Z'); $alpha2 = range('a', 'z'); Capitals and non capitals, right? And what should I do in the foreaches? I would love to solve all the possible options (all phase and all letters) with one loop but I don't mind having more than one. My professor doesn't answer to questions, he says that we have to fight our way out of the problems
  7. The output is supposed to be all the options that are SET and different than !=, but no repeats... I don't know how to do the two options that you considered (2 and 3) Can you help me with this loop please? I am really confused and have no idea where to start... I am sorry... I want to create a loop that goes like this: name_of_phase(maybe-a-loop-for-the-phases?)_(a-to-z)(A-TO-Z)_act_(a-to-z) If I have to create multiple loops I won't mind I just want to solve this matter =( I have no ideia what to do... And thanks for your help
  8. I tried using => without luck I am desperate, I am sure that I will fail my test tomorrow, it's a loop like this.
  9. Hello, I'm sorry, I have another doubt, I want to create an index.php that it's just a menu with 2 options, each option brings a form and the action of that form is the php that I would like to load in the same page, can someone provide me a simple tutorial for this? Is there any easy way to make this happens without Ajax, etc? Thanks <3
  10. Hello, first of all thanks for letting me register in this forum, I've been reading some of the topics and they really helped me so far! I am trying to make a loop for my school project but unfortunately I couldn't solve it alone... These are my variables: <?php $_POST["1st_phase_aL"] = "Paradise"; $_POST["1st_phase_aL_act_a"] = "Sonya and me"; $_POST["1st_phase_aL_act_b"] = "Katie and me"; $phases = array("1st_phase_"); $letters = range('A', 'Z'); $firsts = array(); for($i = 'a';$i <= 'z';$i++){ for($j = 'a'; $j <= 'z';$j++){ foreach ($phases as $phase) { foreach ($letters as $letter) { $firsts[] = $phase . $i . $letter; $firsts[] = $phase . $i . $letter . "_act_" . $j; } } } } foreach($firsts as $first) { if(isset($_POST[$first]) && $_POST[$first]!="") echo "*" . $_POST[$first] . "<br/>"; } ?> This results in a double "paradise" plus Katie and Sonya. Why does paradise appears 2 times? I have 3 cycles like this for all the championship stages (1st stage, 2nd stage, 3rd stage, semi-final and great-final), every single one of them have letters from A to Z in the structure that I presented in this example... Can somebody help me with a great loop to solve this problem? And tell me one thing, even with a loop with all the phases, if I get them all in the array first[], how would I display them on the HTML? I want to separate them by phase, that's why I am doing a loop for each phase... Short version: - Loop is giving me duplicate result (major problem) - Would like to have a loop for all the competition stages - If I have an array with all the competition stages, how would I echo them into the html (I cannot refer to the phase name, right? I want to group them into phases) THANKS!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.