amalafrida Posted August 22, 2012 Share Posted August 22, 2012 Trying to POST values from a table ... each table cell represents 1 hour of each day for 6 months ... total approx. 4000 the cells are named datacell[0] ... datacell[4000] however, when i foreach($_POST['datacell'] as $key=>$val) { $codes.=$val; } echo strlen($codes); strlen is only 1001 ... same if I push them into an array any suggestions? beginning to think I have reached an unwieldy limit here ... break the calendar up ... present only one month at a time? Quote Link to comment https://forums.phpfreaks.com/topic/267439-cannot-get-all-post-values/ Share on other sites More sharing options...
Jessica Posted August 22, 2012 Share Posted August 22, 2012 Are the form elements checkboxes? A table cell is not a form element that would have a name, it's going to be an input with a type. If the type is checkbox, the value isn't sent in the post array when it's not checked. Quote Link to comment https://forums.phpfreaks.com/topic/267439-cannot-get-all-post-values/#findComment-1371536 Share on other sites More sharing options...
amalafrida Posted August 22, 2012 Author Share Posted August 22, 2012 should have specified: each POST element looks like this: <td> <input type='text' name='datacell[5]' value='I' /></td> Quote Link to comment https://forums.phpfreaks.com/topic/267439-cannot-get-all-post-values/#findComment-1371559 Share on other sites More sharing options...
Jessica Posted August 22, 2012 Share Posted August 22, 2012 At the top of the page, before you use the array. add print '<pre>'; print_r($_POST); What does it show? All of them? Quote Link to comment https://forums.phpfreaks.com/topic/267439-cannot-get-all-post-values/#findComment-1371563 Share on other sites More sharing options...
Christian F. Posted August 22, 2012 Share Posted August 22, 2012 each table cell represents 1 hour of each day for 6 months. Why have you done it like this, instead of just saving a timestamp in a single column? By the looks of things, you've made things a lot more complicated for yourself than necessary. Quote Link to comment https://forums.phpfreaks.com/topic/267439-cannot-get-all-post-values/#findComment-1371571 Share on other sites More sharing options...
amalafrida Posted August 22, 2012 Author Share Posted August 22, 2012 I don't understand your "timestamp/column" comment. The first cell of each row carries a timestamp. a typical row resembles the following: <td> <input type='text' name='date[1345438800]' value='Mon-20-Aug' /></td> <td> <input type='text' name='datacell[0]' value='Z' /> </td> .... <td> <input type='text' name='datacell[23]' value='A' /> </td> I'm looping through and picking up each day's sequence of 24 values and placing them into an array ... key=timestamp value=24 letter codes ... then to the database with it ... user is free to modify any of the available text boxes. Quote Link to comment https://forums.phpfreaks.com/topic/267439-cannot-get-all-post-values/#findComment-1371584 Share on other sites More sharing options...
Christian F. Posted August 22, 2012 Share Posted August 22, 2012 According to your post, you have a series of cells representing a series of points in time. This is not an optimal way to solve a problem. Time isn't a description of the data, it is the data itself. Not to mention how much more difficult it becomes to actually retrieve the data associated with those points in time, as you now have to loop through tens of thousands of fields, instead of just one row per data point with some actual data. To show what I mean in code, instead of using something like this: day, user, time_1, time_2, time_3, time_4, time_6.... (And so forth) You should be using something like this: user, time, event As you see, not only does this describe the data a lot better, but you only have three fields to work with. In addition to that, they all three contain data all of the time, unlike the first example. Quote Link to comment https://forums.phpfreaks.com/topic/267439-cannot-get-all-post-values/#findComment-1371586 Share on other sites More sharing options...
amalafrida Posted August 22, 2012 Author Share Posted August 22, 2012 still foggy. are you then suggesting that the table be structured as follows: each row should contain 2 cells ... 1) a timestamp cell 2) one cell containing 24 text boxes? thanks for your patience. Quote Link to comment https://forums.phpfreaks.com/topic/267439-cannot-get-all-post-values/#findComment-1371591 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.