doushenxu7294 2013-06-26 18:03
浏览 32

too long

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; ">

  • 写回答

2条回答 默认 最新

  • dsubq24666 2013-06-26 18:08
    关注

    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.";
      }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类