【发布时间】:2017-06-05 02:26:00
【问题描述】:
<?php
$con = mysqli_connect('localhost','root','');
if(!$con)
{
echo 'not connected to server';
}
if(!mysqli_select_db($con,'user_table'))
{
echo 'database not selected';
}
$mobilenumber = $_POST['mobilenumber'];
$operator = $_POST['operator'];
$state = $_POST['state'];
$sql = "INSERT INTO user_details (mobilenumber,operator,state) VALUES ('".$mobilenumber."','".$operator."','".$state."')";
if(!mysqli_query($con,$sql))
{
echo 'not inserted';
}
else
{
echo 'inserted';
}
//$select="insert into user_details (mobilenumber,operator,state) VALUES ('".$mobilenumber."".$operator."".$state."')";
//$sql=mysql_query($select);
//print '<script type="text/javascript">';
//print 'alert("the data is inserted.....")';
//print '<script>';
//mysql_close();
?>
<form method="post" action="insert.php" id="submitForm">
<select id="operator" type="select" ng-model="operatorName" ng-class="operatorError ? 'error-border':''" autocomplete="off" placeholder="Select operator" ng-click="showOperators($event);" name="operator" method=POST action=/insert.php class="form-control fetchoperators drpdwn-arrow ng-pristine ng-valid ng-touched" required>
<select name="state" class="state" id="state" required name="state" method="post" action="insert.php">
【问题讨论】:
-
您是否希望有人在您发布代码时甚至尝试回答这个问题......?
-
兄弟添加响应什么是消息(Response)。
-
你有什么错误吗?电流输出是多少?此外,如果您无法连接到数据库,您应该继续尝试其余的,请尽量明确并指出您的问题或至少,您尝试了什么。帮助那些无偿帮助你的人!
-
使用 提交可能会帮助您解决问题
标签: php sql phpmyadmin