Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8710813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:43:19+00:00 2026-06-13T04:43:19+00:00

I have multiple input tag submitted from previous page, say step1.php like this :

  • 0

I have multiple input tag submitted from previous page, say step1.php like this :

<input type="hidden" name="block01" value="001"/>
<input type="hidden" name="block02" value="012"/>
<input type="hidden" name="block03" value="002"/>
<input type="hidden" name="block04" value="005"/>
<input type="hidden" name="block05" value="008"/>
<input type="hidden" name="block06" value="015"/>

now I want to process those inputs in the step2.php and I have 2 options to do it, either using Array or Loop.

If I’m using array, those inputs will be appended like this :

<?php
$stack = array(""); //empty array declared

// I assume I have some codes here to 'catch' those inputs and put it as array_push
array_push($stack, "001", "012", "002", "005", "008", "015");
print_r($stack);
?>

compare to array, I have this LOOP option too :

<?php
$i = 1;
$x = 'block0'.$i;
$webBlock = $_POST[$x];

while (!empty($webBlock)){
    $x = 'block0'.$i;
    $webBlock = $_POST[$x];
    echo $webBlock . "<br />";  
    $i++;
}

?>

both are solutions of my problem on step2.php. I just need your opinion which is more less memory / cpu consuming? that’s all…

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:43:20+00:00Added an answer on June 13, 2026 at 4:43 am

    In first case, you are using array_push() and print_r(). The first function uses a loop to push arguments passed onto a stack. The second function that is print_r() also uses a loop to print all the values of the array. So, basically you are running loop twice to do the task.

    Where as in second case, you have written a code to handle both things at once. So, this method just needs to loop once. Moreover, looking into the working of print_r() and echo, if you run echo X times and use print_r() to print X values, the echo is bit faster than print_r. Read php documentation for more info about all these function.

    So, the second way is better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTML form that needs multiple submit buttons, like this: <input type=submit
I have HTML code like this : <li><input type=hidden value=001 class=block-hidden-input /> <a href=#
I have multiple input fields on my page. I Regex them with a css
I have multiple input textboxes in my page. I want to reset particular text
I have form with multiple input type=radio with text next to them. I want
I have code like this : <?php $username = 'johndoe'; ?> <head> <script> ...
I have dynamic page. There are multiple checkboxes & I am using this script
I have a form input field that accepts multiple tags from a user, a
I have a php page which has multiple form tags. each form is dealing
i've this problem for days... I have to load from php the entire html

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.