How to insert into tables with one-to-many relationship containing foreign key
Hello everyone, I'm good with a doubt, I have a relationship between two tables in my mysql database as follows:
MyquestionishowcanIgettheinsertioninthetwotablessinceinmywireframeasrequirementisrequestedthis,thenmyformIhavethefollowing:
<formaction="#" method="POST" enctype="multipart/form-data">
<h2>Painel de inserção de imagens</h2>
<input class="btn btn-success" required="" type="file" name="fileUpload" id="passaValor" title="inserir imagens"> <br></br>
<label>Qual Pagina deverá ser exibida</label>
<select required="" name="id_pagina">
<?php
$daoPagina->selecionaTodasPaginas();
?>
</select>
<label>Titulo, Coloque até 50 letras</label>
<input class="input-xxlarge" type="text" name="titulo" required=""> <br/><br/>
<label>Descrição total das imágens não poupe suas palavas</label>
<textarea class="input-xxlarge" name="textoDaImagem" required="" rows="5"> </textarea><br></br>
<input class="btn btn-large btn-primary" type="submit" value="Enviar">
</form>
Well the question of inserting images is succinct for me, what I would like to know is, how do I pass the image_id at that point in my code:
$daoDescricaoImagem = new DescricaoImagemEntity("", $titulo, $textoDaImagem, 42);
where you read the number 42 would be where I would like to pass my image_id in this case I passed it without being dynamic to test, the process is the following I enter my image and then I want to insert my image description just for that image
If anyone has a suggestion thank you, I'm using PDO.