Can anyone tell me if there is any error in the code. Because I think that $ _POST is not properly defined, because it didn't skips the first IF even when there is some value
for($i=1; $i<=15; $i++) {
$hbs = "other_text".$i;
if($_POST['other_text'.$i]]=="") {
echo "You didn't eneter quantity";
die();
}
if(!is_int($_POST['other_text'.$i]) || isset($_POST['vin'.$i])) {
$vins .= '<tr><td>'.$_POS['vin_lbl'.$i].'</td><td>'.$_POS['other_text'.$i].'</td></tr>';
}
else {
echo "Incorrect data for quantity.
Please go back.";
}
}
Now show me that Undefined index: other_text1 so i checked the form in html and this is the code of the textbox <input type="text" value="1" disabled name="other_text1" style="width:15px; padding:1px; height:10px; font-size:9px; background-color:#FFF; box-shadow:none; ">
Seem you have an extra closing bracket here
if($_POST['other_text'.$i]] <----
and your missing a semi colon here
echo "You didn't eneter quantity"; die() <-----
this script SHOULD look like
for($i=1; $i<=15; $i++) {
$hbs = "other_text".$i;
if($_POST['other_text'.$i]=="")
{
echo "You didn't eneter quantity"; die();
}
if(!is_int($_POST['other_text'.$i])|| isset($_POST['vin'.$i]))
{
$vins .= '<tr><td>'.$_POST['vin_lbl'.$i].'</td><td>'.$_POST['other_text'.$i].'</td></tr>';
}
else echo"Incorrect data for quantity.
Please go back.";
}
Why there is an additional closing square bracket ]]
??
if($_POST['other_text'.$i]]==""){ echo "You didn't eneter quantity"; die() }
It should be
if($_POST['other_text'.$i]==""){ echo "You didn't eneter quantity"; die() }
You also have a spell mistake $_POS
?? it should be $_POST
$vins .= '<tr><td>'.$_POST['vin_lbl'.$i].'</td><td>'.$_POST['other_text'.$i].'</td></tr>';
Also remove de here
after the loop