2015-10-04 85 views
0

我有這張表包含來自數據庫表「患者」的數據。從表中獲取數據以插入到另一個數據庫表

enter image description here

<td> 
    <a href="{{ URL::to('/addvisit/'.$patient->pID) }}"> 
    <img src="images/visit.png" style="width:30px; height:30px;"> 
    </a> 
</td> 

當點擊圓圈圖標會重定向到一個頁面,將數據庫中的表「參觀」插入一個表格。

下面

的形式:

{!! Form::model($patient, ['url'=>'visit/' . $patient->pID, 'method' => 'PATCH']) !!} 
      <div class="form-group"> 
       {!! Form::label('fname', 'Full Name',['class' => 'control-label'])!!} 
       {!! Form::text('pName',null,['class' => 'form-control']) !!} 

       {!! Form::label('address', 'Address',['class' => 'control-label'])!!} 
       {!! Form::text('pAddress',null, ['class' => 'form-control']) !!} 

       {!! Form::submit('SUBMIT',['class' => 'form-control btn btn-success']) !!} 
      </div> 
{!! Form::close() !!} 

我怎樣才能從「病人」表中添加病人ID被設置爲在「訪問」表的外鍵。

回答

0

通過控制器再次將它傳遞到窗體的視圖並將其存儲在隱藏的輸入上

相關問題