PHP mysql查询代码在localhost上完美运行,但不提交到实时服务器上的数据库

时间:2014-03-11 11:04:42

标签: php mysql forms localhost

以下代码在我的localhost计算机上运行良好。除了数据库的用户名和密码之外,我没有更改任何代码。我是PHP的新手,但我想做的就是让用户选择存储在数据库中的单选按钮信息。这是我的PHP ..

在session_start();

    if(isset($_POST['submit'])){


$conn = mysql_connect($HOSTNAME, $USERNAME, $PASSWORD)or  die( 'Could not connect: ' . mysql_error());


//mysql_select_db($DATABASE_NAME);
mysql_select_db($DATABASE_NAME, $conn) or die('');

    if (isset($_SESSION['username'])){
        $username= $_SESSION['username'];
    } else{
        $username= "FAIL";

    }

    $informant="informant";
    $mobilitylist ="mobilitylist";
    $transferslist ="transferslist";
    $dressinglist ="dressinglist";
    $toiletlist ="toiletlist";
    $bladderlist ="bladderlist";
    $bowelslist ="bowelslist";
    $groominglist ="groominglist";
    $feedinglist ="feedinglist";
    $bathinglist ="bathinglist";
    $stairslist ="stairslist";


    mysql_query("INSERT INTO digitaladl2 ($informant, $mobilitylist, $transferslist, $dressinglist, $toiletlist, $bladderlist, $bowelslist, $groominglist, $feedinglist, $bathinglist, $stairslist, username) 
                    VALUES ('".$_POST['informant']."','".$_POST['mobilitylist']."','".$_POST['transferslist']."',
                    '".$_POST['dressinglist']."','".$_POST['toiletlist']."','".$_POST['bladderlist']."','".$_POST['bowelslist']."'
                    ,'".$_POST['groominglist']."','".$_POST['feedinglist']."','".$_POST['bathinglist']."','".$_POST['stairslist']."','".$username."')");

    }
            ?>

html表单太长而无法粘贴所有字段,因此这里只是前两个单选按钮选项。

    <h4> Specifiy the informant when the Barthal Index is done in the community </h4>
    <input type="radio" name="informant" value="Patient">Patient<br>
    <input type="radio" name="informant" value="Main Support Person">Main Support Person<br>
    <input type="radio" name="informant" value="Both">Both<br>
    <input type="radio" name="informant" value="Other">Other<br>

    <h4><p> Mobility </p></h4>
    <input type="radio" name="mobilitylist" class="0" value="Immobile" >0 Immobile<br>
    <input type="radio" name="mobilitylist" class="1" value="Wheelchair independant (including corners/doors)" >1 Wheelchair independant (including corners/doors)<br>
    <input type="radio" name="mobilitylist" class="2" value="Help of one untrained person, including supervision" >2 Help of one untrained person, including supervision<br>
    <input type="radio" name="mobilitylist" class="3" value="Independant (may use aid)" >3 Independant (may use aid) <br>

在实时服务器上提交表单后,没有任何反应 - 没有数据输入数据库。然而,在localhost服务器上运行完美。在此先感谢,所有帮助表示赞赏!

0 个答案:

没有答案