1
How to insert into tables with one to many relationship containing foreign key
Hello everyone all right I’m having a doubt, I have a relationship between two tables in my mysql data ban as follows:
My question is how I will be able to insert the two tables since my wireframe as a requirement is requested this, so my form I have the following:
<form action="#" 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 id_image at this point of my code:
$daoDescricaoImagem = new DescricaoImagemEntity("", $titulo, $textoDaImagem, 42);
where if reading the number 42 would be where I would like to pass my id_image in this case passed it without being dynamic to test, the process is the following I insert my image and then I want to insert my image description just for this image.
if anyone has a suggestion thank you, I am using PDO.
The information is in different form?
– rray
are not in the same form.
– André Martins