Gagan
Gagan

Reputation: 31

how to fetch data using foreach

<input name="auth[]" type="text" id=" " value="<?php echo $cite_aut[$i]; ?>">

Above are text fields in html. Now how to get text fields values in a array variable in another php page. I tried it by using foreach loop (foreach($val as $_POST['author'])... but it fetch 1 extra value for $val, if there are 5 text boxes then it is fetching 6 values, 6th value is "array".

can someone explain how to do it?

Upvotes: 0

Views: 463

Answers (2)

xkeshav
xkeshav

Reputation: 54016

TRY

foreach($_POST['auth'] as $key => $val) {
  echo $val;
}

Upvotes: 1

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

Should be:


foreach($_POST['auth'] as $key => $val) {
  ......
}

Upvotes: 4

Related Questions