adam291086 Posted September 4, 2008 Share Posted September 4, 2008 i have a form which will submit an x amount of file names. x meaning the user can select how many files he/she wants to zip. I can get the possible number of files the user can select. Now heres my problem When the form information is sent each check box has the name zip1 zip2 ect. The number after each zip will differ depening on how many files are in the directory the user is looking at. so i have the number after each zip but i need away to print all the filenames sent from the form into an array. I thought of something like for($i = 0; $i < $_POST['number']; $i++) { echo $_POST['zip'.$i]; } $_POST['number'] is the value of possible files the user can select to zip. but nothing happens any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/122720-solved-array-help/ Share on other sites More sharing options...
JonnoTheDev Posted September 4, 2008 Share Posted September 4, 2008 You are better defining the checkbox name as an array so no loop is required: <input type="checkbox" name="zipnum[]" value="1" /> <input type="checkbox" name="zipnum[]" value="2" /> <input type="checkbox" name="zipnum[]" value="3" /> and so on Then you can just view the values in the post array print_r($_POST['zipnum']); Quote Link to comment https://forums.phpfreaks.com/topic/122720-solved-array-help/#findComment-633756 Share on other sites More sharing options...
adam291086 Posted September 4, 2008 Author Share Posted September 4, 2008 thats awesome. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/122720-solved-array-help/#findComment-633761 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.