douzhi3779 2016-07-28 09:11
浏览 48


I have a problem.. I tried today a lot to make this working but it seems to be impossible for me.. so I decided to ask help here. So I have a form which needs to be added on database table when submit button is pressed. This is php code I currently use.. I removed my tries btw:

 $pdo = new PDO('mysql:host=;dbname=', '', '');
 $sql = "SELECT * FROM games LIMIT 10";
 foreach ($pdo->query($sql) as $row) { 

my HTML code (form):

<form class="form-group" method="POST" action="">
    <div role="tabpanel" class="tab-pane active" id="home">
        <div class="form-group" style="margin-top: 15px;">
            <label for="exampleInputEmail1">Game Title</label>
            <input type="text" class="form-control" id="exampleInputEmail1" placeholder="" name="gtitle" />
        <div class="form-group">
            <label for="exampleInputPassword1">YouTube Link</label>
            <input type="text" class="form-control" id="exampleInputPassword1" placeholder="" name="ytlink" />
        <div class="form-group">
            <label for="exampleInputPassword1">Link Source</label>
            <input type="text" class="form-control" id="exampleInputPassword1" placeholder="ex: GLEAM, DLH, FAILMID, HRKGAME, INDIEGALA, OTHER, STEAM" name="slink" />
        <div class="form-group">
            <label for="exampleInputPassword1">Link to Free Steam Keys</label>
            <input type="text" class="form-control" id="exampleInputPassword1" placeholder="KEY MUST GIVE +1 TO THE STEAM LIBRARY GAME COUNT" name="keysl" />
        <label for="exampleInputPassword1">Steam App ID</label>
        <div class="input-group" style="padding-bottom: 10px;">
            <span class="input-group-addon" id="basic-addon3"></span>
            <input type="text" class="form-control" id="basic-url" aria-describedby="basic-addon3" placeholder="App ID" name="appid" />
        <div class="form-group">
            <label for="exampleInputPassword1">Categories</label>
            <div class="checkbox">

                <label class="radio-inline">
                    <input type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1" /> 1
                    <h4><span class="label label-success">Keys Available</span></h4>
                <label class="radio-inline">
                    <input type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2" /> 2
                    <h4><span class="label label-danger">No Keys left</span></h4>

            <button type="submit" class="btn btn-default" name="insert">Submit</button>



Thank those who help me.

  • 写回答

2条回答 默认 最新

  • dpca31461 2016-07-28 10:59

    Try this and in the radio button put value as '1' and '2' instead of 'option1' and 'option2'

            $query_ins="INSERT INTO tbl_game(game_title,youtube_link,link_source,link_steam_keys,app_id,categories) VALUES(:game_title,:youtube_link,:link_source,:link_steam_keys,:app_id,:categories)";
                echo $error['2'];
    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序