ここで私はwhileループの問題に直面しています。(私は思う)私のすべてを格納することができない私のHTMLフォームにMySQLのテーブルからデータを取得します。私のすべてを格納することができませんMysqlテーブルからのデータを新しいHTMLフォームに取得します。
最初の行のみが掲載なっていると、行の残りの部分はwhileループから繰り返し取得、同じ名前の要素が原因で投稿されていない、
ここで$ _POST [「mechanic_name」];あなたはPLSのアドバイス
<?php
include("db_conection.php");
$view_users_query="select * from mechanic";//select query for viewing users.
$run=mysqli_query($dbcon,$view_users_query);//here run the sql query.
while($row=mysqli_fetch_array($run))//while look to fetch the result and store in a array $row.
{
$mechanic_ID=$row[0];
$mechanic_name=$row[1];
?>
<tr>
<td>
<input name="mechanic_ID" type="text" value="<?php echo $mechanic_ID; ?>">
</td>
<td>
<input name="mechanic_name" type="text" value="<?php echo $mechanic_name; ?>">
</td>
</tr>
<!--* For save php script*-->
<?php
include("db_conection.php");//make connection here
if(isset($_POST['register']))
{
$mechanic_ID=$_POST['mechanic_ID'];//here getting result from the post array after submitting the form.
$mechanic_name=$_POST['mechanic_name'];//same
$month=$_POST['month'];//same
if($mechanic_name=='')
{
//javascript use for input checking
echo"<script>alert('Please enter the name')</script>";
exit();//this use if first is not work then other will not show
}
//insert the user into the database.
$insert_schedule="insert into schedule (mechanic_ID,mechanic_Name,) VALUE ('$mechanic_ID','$mechanic_name'[enter image description here][1])";
if(mysqli_query($dbcon,$insert_schedule))
{
echo"<script>window.open('index.html','_self')</script>";
}
}
以下のコードを持つ他の問題を考える場合、これはwhileループ、鉱石ではありませんので、私は。これで何の問題.. を使用しています1時間!plzは私を助けて... `
ok Homam Alhaytham。 –
はい、@Homan Alhaytham、それは良いですありがとう.. しかし、私は1つのテーブルのデータ行の 'コード'値= "<?php echo $ mechanic_ID;?>からエコーしたので、" first_one "を追加しません"私はそれを1つのテーブルからロードします。 私はout value = "<?php echo $ mechanic_ID;で配列関数をテストしました。 ?>それは動作していますが、他のテーブルに格納できるデータをテーブルから取得する必要があります。 (ドロップダウンメニューで動作していますが)テーブル形式が必要です **太字**ここで私は 'メカニックテーブル'からエコーデータを取得し、それを 'スケジュールテーブル' –