0

This is the output of my code Output

Every item has its own item number. I will be entering randomly a value for 3 items, after doing so I will click on the add button and will be redirected to a confirmation page. How will I get the values with its corresponding item?

Thanks in advance for the answers :)

1
  • 1
    What about your actual code? It's a bit broad at this point. Commented Jun 22, 2016 at 6:20

2 Answers 2

2

Use input name as array.

<input type="text" name="price[]" />
<input type="text" name="price[]" />
<input type="text" name="price[]" />
<input type="text" name="price[]" />
<input type="text" name="price[]" />

Get values like this

$price = $_POST['price'];
foreach($price as $key => $val ) {
  echo $val;
  echo "<br>";
}
Sign up to request clarification or add additional context in comments.

Comments

1

You can bind or keep the text box name same as your database row ID so when you submit and in the target page you can redo the select and update the field in the database like

<input type="text" name="$id" />

in the target page use Select Query looping and give

Update table_name set field_name=$_REQUEST[$id] where id=$id

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.