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

atmip9wb  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(303)

单击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>

因为我对php的了解很少,所以需要论坛支持。期待中的主动

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题