I am submitting a lot of data from a form to a php script and I want an efficient way to check if all the data was submitted correctly.
My Code
<?php
$Name = $_POST['Name'];
$ID = $_POST['ID'];
$Submit = $_POST['submit'];
$Reset = $_POST['reset'];
$Topic_1 = $_POST['1'];
$Topic_2 = $_POST['2'];
$Topic_3 = $_POST['3'];
$Topic_4 = $_POST['4'];
$Topic_5 = $_POST['5'];
$Topic_6 = $_POST['6'];
$Topic_7 = $_POST['7'];
$Topic_8 = $_POST['8'];
$Topic_9 = $_POST['9'];
$Topic_10 = $_POST['10'];
$Topic_11 = $_POST['11'];
$Topic_12 = $_POST['12'];
$Topic_13 = $_POST['13'];
$Topic_14 = $_POST['14'];
$Topic_15 = $_POST['15'];
NOTICE I'm not sure that checking if the value isn't
empty
is enough. Consider adding more validation rules.just use
if you also need the array keys look at the function of array_keys. You will get an array of every key.
something like should do it:
Sorry didn't had the time to test
Greetings Martin
Use a
foreach
loop: