duan111112 2013-09-16 20:03
浏览 24

php中的未定义索引使用post但它可以使用update.php上的请求来回显值

I have these two files and i am updating a table but on the update.php file i get error saying Notice: Undefined index: pname , $pcode...... $pname = $_POST["pname"]; here i am storing pname value in pname variable.but it shows error

                        <address>

                           <div class="control-group">



                                    <label class="control-label">Product Name:</label>
                                    <div class="controls">
                                        <input id="pname" name="pname" type="text" value="<?php echo $PName; ?>"
                                        class="input-xlarge">
                                        <p class="help-block"></p>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">Product Code:</label>
                                    <div class="controls">
                                        <input id="code" name="pcode" type="text"  value="<?php echo $PCode; ?>"
                                        class="input-xlarge">

                                    </div>
                                </div>


                                <div class="control-group">
                                    <label class="control-label">Product Price:</label>
                                    <div class="controls">
                                        <input id="price" name="pprice" type="text" value="<?php echo $PPrice; ?>"
                                        class="input-xlarge">

                                    </div>
                                </div>


                            <div class="control-group">
                                    <label class="control-label">Availability:</label>
                                    <div class="controls">
                                        <select id="stock" name="stock" class="input-xlarge">

                                            <option value="1" selected="selected">Available</option>
                                            <option value="0">Not Available</option>

                                        </select>
                                    </div>
                          </div>

                              <div class="control-group">
                                    <label class="control-label">Product Description:</label>
                                    <div class="controls">
                                        <textarea rows="4" cols="50" name="description" > <?php echo $PDescription; ?> </textarea>
                                    </div>
                          </div>


                               <div class="control-group">
                                    Picture 1 :
                                    <div class="controls">
                                     <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
                                    <input  type="file" name="pic1"
                                        class="input-xlarge">

                                    </div>
                          </div>

                           <div class="control-group">
                                    Picture 2 :
                                    <div class="controls">
                                     <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
                                    <input  type="file" name="pic2"
                                        class="input-xlarge">

                                    </div>
                          </div>


                             <div class="control-group">
                                    Picture 3 :
                                    <div class="controls">
                                     <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
                                    <input  type="file" name="pic3"
                                        class="input-xlarge">

                                    </div>
                          </div>


                              <div class="control-group">

                                    <div class="controls">
                                    <input type='hidden' name='id' value="<?php echo $ID; ?>"><br/>
                                        <input type="submit" value="UPDATE" class="btn-large" />

                                    </div>
                                </div>


                              </form>
  • 写回答

2条回答 默认 最新

  • doob0526 2013-09-16 20:06
    关注

    Do you check for form submit?

    if (isset($_POST["pname"])) {
        // do all your form processing here.
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能