-1

CL_IDここでは、show と hide を含む 2 つのフォームを使用した単純なコードで、すべてがうまく機能します。2 番目のフォームを使用して別のテーブルに設定するのを忘れました

だから私はここで何が必要なのかその行を挿入するだけ.$row['cl_id'].で、最初のクエリで取得したものを2番目のフォームに挿入して、データを保存しました '私の問題はすべて「未定義の変数」でした" & その他の "undefined index" の原因($row= mysql_fetch_assoc($data))

私はすべてを試しましたが、変数を定義することを発見しました。

<?php
echo"<style type='text/css'>#here{ display:none; } </style> ";
require ('connections.php');
echo"<hr />";
if(isset($_POST['search'])) {
   $search=(trim($_POST['search']));
   if (empty($search)){echo" insert something to search it ";
   } else{
     $data=mysql_query("SELECT * from cl_info INNER JOIN cl_pro ON cl_pro.cl_id=cl_info.id WHERE cl_info.id LIKE '$search'")or die(mysql_error());
     $num=mysql_num_rows($data);
         if($num<1){echo' no results of your search'; }

        else{?> <style type="text/css">#form1{ display:none; }</style>
                <style type="text/css">#here{ display:block; }</style>
        <?php




              while ($row= mysql_fetch_assoc($data)) {
                //$ak=($row['cl_id'])   ;
//                    echo("<hr/>");
//                     echo("$ak");

 echo("<table with='40%'border='1' align='center'>
  <tr>
  <th>  Client ID</th>
  <th>  Name</th>
  <th>  Phone</th>
  <th>  Date of Birth</th>
  <th>  Blood Type</th>
  <th>  E-mail</th>
  <th>  smoker</th>
  <th>  drugs</th>
  <th>  extra</th>
  <th>  extra2</th>
  </tr>


   <tr>
    <td>".$row['cl_id']."</td>
    <td>".$row['name']."</td>
    <td>".$row['phon']."</td>
    <td>".$row['d_birth']."</td>
    <td>".$row['blood_typ']."</td>
    <td>".$row['email']."</td>
    <td>".$row['smoker']."</td>
    <td>".$row['drugs']."</td>
     <td>".$row['extra']."</td>
    <td>".$row['extra2']."</td>

     </tr> ") ; echo"</table>";



     } } } }

 echo"  where it was  form 1


<form id='form1' action=''  method='post'>
<input type='text' name='search' />
<input type='submit' name='sub'  /> </form>


  " ;

  /////// start  open  new form2 "here "//////


 echo"
<form  id='here' action=''    method='post' >

r: <input type='text' name='r' />
Doz :<input type='text' name='doz' />
Time:<input type='text' name='t/d' />
Date <input type='text' name='date' />
<input type='hidden' name='cl_id'  />
<input type='submit' name='submit' value='Insert'  />

</form> ";

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

  echo('you have isset works right');

   $r =$_POST['r'];
   $doz =$_POST['doz'];
   $t =$_POST['t/d'];
   $date =$_POST['date'] ;
   //$clid =$_POST['cl_id'] ;

 mysql_query ("INSERT INTO scri (id, cl_id, r, doz, time, date) VALUES ('', '$ak', '$r', '$doz', '$t', '$date')")or die ( mysql_error());

}
?>                                 <!---- end of PHP ---->

</body>


</html>
4

1 に答える 1