Maracles Posted November 8, 2009 Share Posted November 8, 2009 My code is currently like this, how could I simplify it? Possibly using a FOR loop somehow? I also then need to check which of the values is 0 and ignore these. All help is appreciated. $daynew1 =$_POST ['day1new']; $daynew2=$_POST ['day2new']; $daynew3 =$_POST ['day3new']; $daynew4 =$_POST ['day4new']; $daynew5 =$_POST ['day5new']; $daynew6 =$_POST ['day6new']; $daynew7 =$_POST ['day7new']; $daynew8 =$_POST ['day8new']; $daynew9 =$_POST ['day9new']; $daynew10 =$_POST ['day10new']; $daynew11 =$_POST ['day11new']; $daynew12 =$_POST ['day12new']; $daynew13 =$_POST ['day13new']; $daynew14 =$_POST ['day14new']; $daynew15 =$_POST ['day15new']; $daynew16 =$_POST ['day16new']; $daynew17 =$_POST ['day17new']; $daynew18 =$_POST ['day18new']; $daynew19 =$_POST ['day19new']; $daynew20 =$_POST ['day20new']; $daynew21 =$_POST ['day21new']; $daynew22 =$_POST ['day22new']; $daynew23 =$_POST ['day23new']; $daynew24 =$_POST ['day24new']; $daynew25 =$_POST ['day25new']; $daynew26 =$_POST ['day26new']; $daynew27 =$_POST ['day27new']; $daynew28 =$_POST ['day28new']; Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 9, 2009 Share Posted November 9, 2009 something like this for ($i=1; $i <= 28; $i++) { ${"daynew$i"} =$_POST ["day{$i}new"]; } Quote Link to comment Share on other sites More sharing options...
Maracles Posted November 9, 2009 Author Share Posted November 9, 2009 Thanks that worked! You've been a great help this weekend, much appreciated. Quote Link to comment 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.