indexing - PHP undefined index submitting textboxes -
i have huge table of textboxes , i'm submitting them all, , named number of row "-" number of column (ex: 1 - 1; 1 - 2; 1 - 3; 1 - 4; 1 - 5; 2 - 1;...),
, i'm trying when button named 'sub' clicked, it'll go 1 one , echo content of textbox, reason php error notification this:
notice: undefined index: 1 - 1 in c:\xampp\htdocs\a11096\2tabelas.php on line 474 notice: undefined index: 1 - 2 in c:\xampp\htdocs\a11096\2tabelas.php on line 474 notice: undefined index: 1 - 3 in c:\xampp\htdocs\a11096\2tabelas.php on line 474 notice: undefined index: 1 - 4 in c:\xampp\htdocs\a11096\2tabelas.php on line 474 notice: undefined index: 1 - 5 in c:\xampp\htdocs\a11096\2tabelas.php on line 474
and on...
my code this:
if(isset($_post['sub'])){ ($i=1;$i<=20;$i++){ ($k=1;$k<=5;$k++){ $tst= $i .' - '. $k; $txt[$k]=$_post[$tst]; echo $txt[$k]; } } }
update
after time noticed using id field, not name, , post method uses name, switched name field , same error still persists.
you adding spaces around constant string in line
$tst= $i .' - '. $k;
which means code looks elements "1 - 1" instead of "1-1".
change
$tst= $i .'-'. $k;
to desired effect.
Comments
Post a Comment