dimanche 4 octobre 2015

Getting a data from a table to insert to another database table

i have this table that contains data from the database table 'patient'.

enter image description here

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

when the circle icon is clicked it will redirect to a page with a form that will be inserted in a database table 'visit'.

below is the form:

{!! 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() !!}

how can I add the patient ID from the 'patient' table to be set as a foreign key in the 'visit' table.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire