My HTML form passes only part of the data

I have a page which receives user data from the DB and displays it in a multidata form for updatind and deleting user inserted data.

On the page where the form data is processed I tested the data and I was surprised to see that out of 225 rows of data (I indexed them and checked the index row after row)
. I get only 209 rows
here is the form code

 <form method="POST" action="alter_db.php">
 <section>Find a trade with ticket number :
            <input type="text" id="search_ticket" name="tickt" placeholder="  insert A ticket number">
            <input type="submit" id="Find_ticket" value="Find This Ticket">
 <div class="table-wrapper">
					<th>Open Time</th>
					<th>Open Price</th>
					<th>Stop Loss</th>
					<th>Take Profit</th>
					<th>Close Time</th>
					<th>Close Price</td>
					<th>Update row</th>
					<th>Delete row</th>
		 foreach ($positions as $pkey=>$pval)
		   echo '<tr>
				<input type="hidden" name="id[]" value ="'.$pval['id'].'">
				<td name="trade[]">'.$i.'</td>
				<td><input type="text" name="ticket[]" value ="'.$pval['ticket'].'"></td>
			    <td style="width:12%"><input type="text" name="o_time[]" value ="'.$pval['o_time'].'"></td>
			    <td><input type="text" name="type[]" value ="'.$pval['type'].'"></td>
			    <td><input type="text" name="size[]" value ="'.$pval['size'].'"></td>
				<td><input type="text" name="item[]" value ="'.$pval['item'].'"></td>
				<td><input type="text" name="o_price[]" value ="'.$pval['o_price'].'"></td>
				<td><input type="text" name="s_l[]" value ="'.$pval['s_l'].'"></td>
				<td><input type="text" name="t_p[]" value ="'.$pval['t_p'].'"></td>
				<td style="width:12%"><input type="text" name="c_time[]" value ="'.$pval['c_time'].'"></td>
				<td><input type="text" name="c_price[]" value ="'.$pval['c_price'].'"></td>
				<td><input type="text" name="profit[]" value ="'.$pval['profit'].'"></td>
				<td><input type="checkbox" name="updatex[]"></td>
				<td><input type="checkbox" name="deletex[]"></td>
	<!-- <input type="submit" id="update" class="ud" value="Update selected rows" name="update"> -->
	<input type="submit" id="delete" class="ud" value="Delete selected rows" name="submit">


Here is a screensht of its bottom

Here is the code of the form’s action page



 //header("Location: update_data_all.php");


and here is a screenshot of the result

Whay did I miss here ? What is wrong with my code

I want to let users to either update or delete rows

I thought that maybe 2 submit buttons
named “delete” and “update” cause a problem . I disabled the “update”. nothing changes.

I also noticed that in Chrome and Firefox, when I change the code of a page, save it, refresh the browsers -
The browser “ignores” the change and"remembers" the code before the change.
Has ot got a connection to my problem ?

You ask why you only get certain rows yet you haven’t shown us the code you are using to get the data.

You are probably running up against the php max_input_vars setting - You would be getting a php warning, if your php error related settings are set up to display/log all php errors. You can change this setting, but first ask yourself if you should be trying to display this amount of data in one form and submit it all at one time.

A human isn’t really going to want to look at 100’s (225+ for what you are showing) of rows of data at a time, just to decided to update/delete a few of them. Wouldn’t it be less error prone to list the rows matching any search term, with an update/delete link for each row, that when clicked takes you to an update/delete page with a form for just one row of data that when submitted causes the desired action for that row of data? If you want to mass delete rows, make a page to just do that without all the rest of the form fields needed to update the data. Another method would be to use a separate form per row of data.

Also, since only checked checkboxes are submitted, your current scheme has no way of relating a checkbox to the row it belongs to. You would need to use the id value as the form field array indexes in order to associate any submitted checkbox with the row it belongs with.

BTW - in real applications, data is almost never actually deleted. If someone thought the data was important enough to insert, it is important enough that should it accidentally get deleted, it can be recovered. You would typically just UPDATE a ‘status’ column with a value that indicates the data is deleted/not used, then exclude the data in normal operations (a database table ‘view’ comes in handy for ‘automatically’ doing this.).


Its right there

But that takes data from the form submission, there is nothing showing data coming from a database.

This Is the page which receives the updated date prom the form and updates the database.

What you see there is a primary check to see what I receive from the form.
I was surprised to see that not all rows are received from the form.

mabismad suggested to offer users to update data differently. I accepted his idea.Yet I am very curious to understand what happened here.
I checked if there is a limit for amount of data pased in a form. didn’t find any

Does that mean that the setting that I named and provided a link to the documentation for, is set to a high enough value on your system so that it is not the cause of the problem?

BTW - before I posted that, I tested if each array form field counts as a single input variable or if each element of an array form field counts as an input variable, and for the default setting of a 1000 on my system, the submitted data from your form markup was truncated at about index 82/83.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.