jani Posted November 26, 2008 Share Posted November 26, 2008 Hello! I have a directory layout processed from a (emulator)diskimage, i select files with a checkbox ("FILENUMBER") and _all_ FILENAMEs (not only selected) from that diskimage are POST:ed to another page. What i want is to run the both POSTs against eachother, and return the filenames of selected files, see example below. ..so, i need to connect the FILENUMBERS connected to its respective FILENAME. I did some testing here, and i kinda stumbled upon something i don't know where to start with. "var_dump($_POST)" gives: ["FILENUMBER"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "2" ["FILENAME"]=> array(4) { [0]=> string(24) "file1" [1]=> string(24) "file2" [2]=> string(24) "file3" [3]=> string(24) "file4" If i run these through "implode( ', ', $_POST['xxxxxxxxxx']") i get : filenumber(s) selected: 1,2 filenames of all files: file1, file2, file3, file4 filename(s) of selected files: ?????? (here is where i need help) TIA /Jani Link to comment https://forums.phpfreaks.com/topic/134396-how-to-connect-two-posted-values-to-eachother/ Share on other sites More sharing options...
wildteen88 Posted November 26, 2008 Share Posted November 26, 2008 have a look into array_marge Alternatively modify your form field names to be something like <input type="text" name="file[0][numb]" /> <input type="text" name="file[0][name]" /> <input type="text" name="file[1][numb]" /> <input type="text" name="file[1][name]" /> <input type="text" name="file[2][numb]" /> <input type="text" name="file[2][name]" /> Now $_POST['file'] will be in this format: Array ( [0] => Array ( [name] => file1 [numb] => 0001 ) [1] => Array ( [name] => file2 [numb] => 0002 ) [2] => Array ( [name] => file3 [numb] => 0003 ) ) Link to comment https://forums.phpfreaks.com/topic/134396-how-to-connect-two-posted-values-to-eachother/#findComment-699719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.