Php 表单:从表单到mysql数据库表的数据提交

Php 表单:从表单到mysql数据库表的数据提交,php,html,mysql,sql,forms,Php,Html,Mysql,Sql,Forms,单击Submit按钮打开一个空白action.php,表中既没有任何错误消息,也没有数据插入 请求是否有人可以共享action.php的干净代码,或者指导我使用相同的代码。我在connection.php中有数据库登录凭据 我的表格有以下代码: <form class="form-horizontal" action="action.php" method="Post"> <div class="form-group"> <label cla

单击Submit按钮打开一个空白action.php,表中既没有任何错误消息,也没有数据插入

请求是否有人可以共享action.php的干净代码,或者指导我使用相同的代码。我在connection.php中有数据库登录凭据

我的表格有以下代码:

<form class="form-horizontal" action="action.php" method="Post">
    <div class="form-group">
        <label class="control-label col-sm-2" for="vlocation">Location:</label>
        <div class="col-sm-8">
            <?php 
            $reg=$thisitem['location'];
            $sql= "select  id, location from location";          
            $res= mysql_query($sql);    
            $sql1= "select  * from location where id='$reg'";            
            $res1= mysql_query($sql1);
            $thiscat =mysql_fetch_array($res1);          
            ?>                                  
            <select name="vlocation" class="form-control" value="<?php echo $thiscat['location']; ?>">                  
                <option value="" disabled selected>Select location</option>
                <option value="<?php echo $thiscat['id']; ?>"><?php echo $thiscat['location']; ?></option>
                <?php  
                while($rows=mysql_fetch_array($res)){?>
                    <option value="<?php echo $rows['id']?>"> <?php echo $rows['location'];?> </option>
                <?php }?>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vtype">Category:</label>
        <div class="col-sm-8">
            <?php 
            $reg=$thisitem['vtype'];
            $sql= "select  id, type from vtype";             
            $res= mysql_query($sql);    
            $sql1= "select  * from vtype where id='$reg'";           
            $res1= mysql_query($sql1);
            $thiscat =mysql_fetch_array($res1);          
            ?>                                  
            <select name="vtype" class="form-control" value="<?php echo $thiscat['type']; ?>">                  
                <option value="" disabled selected>Select venue category</option>
                <option value="<?php echo $thiscat['id']; ?>"><?php echo $thiscat['type']; ?></option>
                <?php  
                while($rows=mysql_fetch_array($res)){?>
                    <option value="<?php echo $rows['id']?>"> <?php echo $rows['type'];?> </option>
                <?php }?>
            </select>
        </div>
    </div>                    
    <div class="form-group">
        <label class="control-label col-sm-2" for="vname">Name:</label>
        <div class="col-sm-10"> 
            <input type="text" class="form-control" name="vname" placeholder="Enter venue name">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vseo">SEO:</label>
        <div class="col-sm-10"> 
            <input type="text" class="form-control" name="vseo" placeholder="Enter venue seo string">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vpremium">Premium:</label>
        <div class="col-sm-10"> 
            <input type="text class="form-control" name="vpremium" placeholder="Enter PREMIUM if venue is premium">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vrank">Rank:</label>
        <div class="col-sm-10"> 
            <input type="number" class="form-control" name="vrank" placeholder="Enter venue rank">
        </div>
    </div>                    
    <div class="form-group">
        <label class="control-label col-sm-2" for="vcontact">Contact:</label>
        <div class="col-sm-10"> 
            <input type="text" class="form-control" name="vcontact" placeholder="Enter venue contact numbers">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vcapacity">Capacity:</label>
        <div class="col-sm-10"> 
            <input type="text" class="form-control" name="vcapacity" placeholder="Enter venue capacity">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vprice">Price:</label>
        <div class="col-sm-10"> 
            <input type="text" class="form-control" name="vprice" placeholder="Enter venue price details">
        </div>
    </div> 
    <div class="form-group">
        <label class="control-label col-sm-2" for="vaddress">Address:</label>
        <div class="col-sm-10"> 
            <textarea name="vaddress" class="form-control" placeholder="Enter venue address"><?php echo $thisitem['vaddress']; ?></textarea>
        </div>
    </div> 
    <div class="form-group">
        <label class="control-label col-sm-2" for="vinclusions">Inclusions:</label>
        <div class="col-sm-10"> 
            <textarea name="vinclusions" class="form-control" placeholder="Enter inclusions"><?php echo $thisitem['vinclusions']; ?></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vspaces">Spaces:</label>
        <div class="col-sm-10"> 
            <textarea name="vspaces" class="form-control" placeholder="Enter spaces available in venue"><?php echo $thisitem['vspaces']; ?></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vaccommodation">Accommodations:</label>
        <div class="col-sm-10"> 
            <input type="text" class="form-control" name="vaccommodation" placeholder="Enter accommodation details">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vimages">Image Gallary URL:</label>
        <div class="col-sm-10"> 
            <input type="text" class="form-control" name="vimages" placeholder="Enter image gallary url">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vdetails">Details:</label>
        <div class="col-sm-10"> 
            <textarea name="details" class="summernote form-control" data-height="200" data-lang="en-US" placeholder="Enter venue details"><?php echo $thisitem['vdetails']; ?></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vmap">Google Map Code:</label>
        <div class="col-sm-10"> 
            <textarea name="map" class="form-control" placeholder="Enter google map code"><?php echo $thisitem['vmap']; ?></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vmtitle">Meta Title:</label>
        <div class="col-sm-10"> 
            <textarea name="vmtitle" class="form-control" placeholder="Enter meta title"><?php echo $thisitem['vmtitles']; ?></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vmkeyword">Meta Keyword:</label>
        <div class="col-sm-10"> 
            <textarea name="vmkeyword" class="form-control" placeholder="Enter meta keywords"><?php echo $thisitem['vmkeyword']; ?></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-2" for="vmdescription">Meta Description:</label>
        <div class="col-sm-10"> 
            <textarea name="vmdescription" class="form-control" placeholder="Enter meta description"><?php echo $thisitem['vmdescription']; ?></textarea>
        </div>
    </div>                       
    <div class="form-group"> 
        <label class="control-label col-sm-2" for="vstatus">Status:</label>
        <div class="col-sm-10">     
            <label><input type="checkbox" name="status"> Enable</label>
        </div>
    </div>
    <div class="form-group"> 
        <div class="col-sm-offset-2 col-sm-10">
            <!-- <button type="submit" class="btn btn-default">Submit</button> -->
            <input class="btn btn-success" type="submit" name="submit" value="Submit">
            <button type="reset" class="btn btn-default">Reset</button>
        </div>
    </div>

</form>  

地点:
类别:
姓名:
搜索引擎优化:
保险费:

请分享您的操作。phpWhy您使用的是长期不推荐的
mysql\uu
代码库?它在许多年前就已经停止使用,并在PHP7中被完全删除。不应使用此库编写新代码。它使您容易受到SQL注入攻击(由于缺少参数化查询支持)和其他潜在的未修补漏洞的攻击。尽快切换到使用
mysqli
PDO
,然后学习如何编写参数化查询以保护数据免受恶意输入。有关风险的简单解释和安全编写查询的一些PHP示例代码,请参阅。无论如何,正如前面提到的,如果问题是表单发布到action.PHP时发生了什么,那么我们当然需要查看该脚本的代码。我们无法修复我们看不见的东西。如果您得到一个空白页面,则表明脚本以某种方式崩溃,但您没有打开PHP错误报告。你可以用谷歌搜索方法来实现这一点。还要检查PHP错误是否被记录到磁盘上,然后您就可以访问磁盘了。一旦您得到准确的错误信息,诊断问题就会容易得多。这是调试错误时需要采取的第一个基本步骤。它显示以下消息(已成功连接)已成功创建新场馆记录。正在创建记录,但由于表单值在提交过程中丢失,因此为空。