How do I get 2 variables with the same ID stored in a BD?How do JavaScript closures work?How to horizontally center a <div>?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I redirect to another webpage?What's the difference between using “let” and “var”?How to check whether a checkbox is checked in jQuery?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

Is it possible to create light that imparts a greater proportion of its energy as momentum rather than heat?

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

Does a druid starting with a bow start with no arrows?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Doing something right before you need it - expression for this?

When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?

Arrow those variables!

Can I ask the recruiters in my resume to put the reason why I am rejected?

What exploit are these user agents trying to use?

How to take photos in burst mode, without vibration?

Why doesn't H₄O²⁺ exist?

What killed these X2 caps?

Is it canonical bit space?

What to put in ESTA if staying in US for a few days before going on to Canada

I would say: "You are another teacher", but she is a woman and I am a man

Do I have a twin with permutated remainders?

Is it possible to run Internet Explorer on OS X El Capitan?

How could indestructible materials be used in power generation?

What is the word for reserving something for yourself before others do?

How to model explosives?

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Is the Joker left-handed?

Should I tell management that I intend to leave due to bad software development practices?

Why was the shrinking from 8″ made only to 5.25″ and not smaller (4″ or less)?



How do I get 2 variables with the same ID stored in a BD?


How do JavaScript closures work?How to horizontally center a <div>?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I redirect to another webpage?What's the difference between using “let” and “var”?How to check whether a checkbox is checked in jQuery?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a form where I enter the data of a course (name, date, number of hours, speaker...), in which I was asked to add more than one speaker to the course,






<div class="col-md-6 animate-box">
<h3>Complete los datos solicitados</h3>
<form action="creacion_curso_bd.php" method="post" enctype="multipart/form-data" name="form1" target="_self" id="form1">
<div class="row form-group">
<!-- nombre curso -->
<div class="col-md-12">
<input type="text" name="nombre_curso" id="nombre_curso" class="form-control" placeholder="Nombre del curso">
</div>
</div>
<!-- fin nombre curso -->
<input type="hidden" id="dir" name="ip" value="<?php echo $ip_usuario; ?>">
<!-- Podría ser <?=$ip?>, como fomra abreviada -->

<!-- Fecha del curso -->
<div class="row form-group">
<div class="col-md-12">
<!-- <input class="form-control required" type="text" name="check_in" id="check_in" placeholder="Fecha de realización"> -->
<input class="form-control required" type="date" name="fecha_curso" id="fecha_curso" placeholder="Fecha de realización">
</div>
</div>
<!-- fin Fecha del curso -->

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="numero_horas" id="numero_horas" class="form-control" placeholder="Cantidad de horas"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="sigper" id="sigper" class="form-control" placeholder="Codigo SIGPER">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="vacantes" id="vacantes" class="form-control" placeholder="Cantidad de vacantes"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="ubicacion" id="ubicacion" class="form-control" placeholder="Ubicación del curso">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<textarea name="descripcion" id="descripcion" cols="30" rows="20" class="form-control" placeholder="Descripción del curso"></textarea>
</div>
</div>

<!-- ambito -->
<div class="row form-group">
<div class="col-md-12">
<select name="ambito" id="ambito" class="form-control" style="height: 50px">
<option value=''>Elija un ambito</option>
<?php
$query = $mysqli -> query ("SELECT * FROM ambito");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_ambito].'">'.$valores[ambito].'</option>';

?>
</select>
</div>
</div>
<!-- fin ambito -->


<div class="row form-group" id="dynamic_form">
<div class="col-md-12">

<select name="p_name" id="p_name" class="form-control" style="height: 50px">
<option value=''>Elija un relator</option>
<?php
$query = $mysqli -> query ("SELECT id_relator, nombre_relator FROM relatores");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_relator].'">'.$valores[nombre_relator].'</option>';

?>
</select>

<div class="button-group">
<a href="javascript:void(0)" class="btn btn-primary; color: #1f27ba" id="plus5">Añadir mas relatores</a>
<a href="javascript:void(0)" class="btn btn-danger" id="minus5">Remover Relator</a>
</div>

<script>
$(document).ready(function()
var dynamic_form = $("#dynamic_form").dynamicForm("#dynamic_form", "#plus5", "#minus5",
limit: 10,
formPrefix: "dynamic_form",
normalizeFullForm: false
);

dynamic_form.inject([
p_name: 'Hemant',
quantity: '123',
remarks: 'testing remark'
,
p_name: 'Harshal',
quantity: '123',
remarks: 'testing remark'
]);

$("#dynamic_form #minus5").on('click', function()
var initDynamicId = $(this).closest('#dynamic_form').parent().find("[id^='dynamic_form']").length;
if (initDynamicId === 2)
$(this).closest('#dynamic_form').next().find('#minus5').hide();

$(this).closest('#dynamic_form').remove();
);

$('form').on('submit', function(event)
var values = ;
$.each($('form').serializeArray(), function(i, field)
values[field.name] = field.value;
);
console.log(values)
event.preventDefault();
)
);
</script>

<!-- fin prueba dinamica relatores -->
</div>
</div>

<br>
<div class="row form-group">
<div class="col-md-12">

<a href="relatores_embed.php?keepThis=true&amp;TB_iframe=true&amp;height=280&amp;width=680" class="thickbox">
<h3>Si quiere agregar otro relator al listado, haga click aquí</h3>
</a>

<input type="submit" name="enviar" onclick="valida_envia()" value="Enviar inscripción" class="btn btn-primary"
id="enviar">
</div>
</div>

</form>
</div>
</div>

</div>
</div>





This sends it to a php archive where I save the data in the DB:






$curso_nom = mysqli_query($con, "SELECT `nombre_curso` FROM `cursos` WHERE `nombre_curso` = '$nombre_curso'");
echo $curso_nom;

if ($curso_nom == null)
$sql = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `descripcion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', '$descripcion', '$id_relatores', 'si')"); //Se insertan los datos a la base de datos y el usuario ya fue registrado con exito.
/* $sql2 = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', 'dsffs', 'si');"); */

if (mysqli_query($con, $sql))
scriptAlertGo('!El curso fue inscrito correctamente!', '#');

else
scriptAlert('!Ha ocurrido un problema en la inscripción, por favor intente nuevamente!', '#');


else
scriptAlertGo('El nombre del curso ya esta registrado en la base de datos', '#');





The problem is to save the variables of id_relator, since these are listbox with a script in javascript which adds more listbox as the user needs, but when I want to send them to the next php I get the following error:



Notice: Undefined index: relational_id in C: Program Files (x86) EasyPHP5.3.0 www training courses creation_curse_bd.php on line 69



I do not know what the problem may be, if someone can guide me a lot of thanks,










share|improve this question
























  • Did you translate the error message? I don't see relational_id in your sql statement but rather the id_relator field. Do you have a field called like that in your table cursos in the database capacitaciones? Any chance you could make your code wall a bit smaller by providing a [help/mcve] instead, and translating the portugese/Spanish (I don't know) to English (as this can help the ones like me who do not understand your native language)

    – Icepickle
    Mar 9 at 0:06












  • Im sorry, I forgot to translate the variables on the code... id_relator = id_speaker capacitaciones = courses

    – Juan Salinas
    Mar 9 at 12:57

















0















I have a form where I enter the data of a course (name, date, number of hours, speaker...), in which I was asked to add more than one speaker to the course,






<div class="col-md-6 animate-box">
<h3>Complete los datos solicitados</h3>
<form action="creacion_curso_bd.php" method="post" enctype="multipart/form-data" name="form1" target="_self" id="form1">
<div class="row form-group">
<!-- nombre curso -->
<div class="col-md-12">
<input type="text" name="nombre_curso" id="nombre_curso" class="form-control" placeholder="Nombre del curso">
</div>
</div>
<!-- fin nombre curso -->
<input type="hidden" id="dir" name="ip" value="<?php echo $ip_usuario; ?>">
<!-- Podría ser <?=$ip?>, como fomra abreviada -->

<!-- Fecha del curso -->
<div class="row form-group">
<div class="col-md-12">
<!-- <input class="form-control required" type="text" name="check_in" id="check_in" placeholder="Fecha de realización"> -->
<input class="form-control required" type="date" name="fecha_curso" id="fecha_curso" placeholder="Fecha de realización">
</div>
</div>
<!-- fin Fecha del curso -->

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="numero_horas" id="numero_horas" class="form-control" placeholder="Cantidad de horas"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="sigper" id="sigper" class="form-control" placeholder="Codigo SIGPER">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="vacantes" id="vacantes" class="form-control" placeholder="Cantidad de vacantes"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="ubicacion" id="ubicacion" class="form-control" placeholder="Ubicación del curso">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<textarea name="descripcion" id="descripcion" cols="30" rows="20" class="form-control" placeholder="Descripción del curso"></textarea>
</div>
</div>

<!-- ambito -->
<div class="row form-group">
<div class="col-md-12">
<select name="ambito" id="ambito" class="form-control" style="height: 50px">
<option value=''>Elija un ambito</option>
<?php
$query = $mysqli -> query ("SELECT * FROM ambito");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_ambito].'">'.$valores[ambito].'</option>';

?>
</select>
</div>
</div>
<!-- fin ambito -->


<div class="row form-group" id="dynamic_form">
<div class="col-md-12">

<select name="p_name" id="p_name" class="form-control" style="height: 50px">
<option value=''>Elija un relator</option>
<?php
$query = $mysqli -> query ("SELECT id_relator, nombre_relator FROM relatores");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_relator].'">'.$valores[nombre_relator].'</option>';

?>
</select>

<div class="button-group">
<a href="javascript:void(0)" class="btn btn-primary; color: #1f27ba" id="plus5">Añadir mas relatores</a>
<a href="javascript:void(0)" class="btn btn-danger" id="minus5">Remover Relator</a>
</div>

<script>
$(document).ready(function()
var dynamic_form = $("#dynamic_form").dynamicForm("#dynamic_form", "#plus5", "#minus5",
limit: 10,
formPrefix: "dynamic_form",
normalizeFullForm: false
);

dynamic_form.inject([
p_name: 'Hemant',
quantity: '123',
remarks: 'testing remark'
,
p_name: 'Harshal',
quantity: '123',
remarks: 'testing remark'
]);

$("#dynamic_form #minus5").on('click', function()
var initDynamicId = $(this).closest('#dynamic_form').parent().find("[id^='dynamic_form']").length;
if (initDynamicId === 2)
$(this).closest('#dynamic_form').next().find('#minus5').hide();

$(this).closest('#dynamic_form').remove();
);

$('form').on('submit', function(event)
var values = ;
$.each($('form').serializeArray(), function(i, field)
values[field.name] = field.value;
);
console.log(values)
event.preventDefault();
)
);
</script>

<!-- fin prueba dinamica relatores -->
</div>
</div>

<br>
<div class="row form-group">
<div class="col-md-12">

<a href="relatores_embed.php?keepThis=true&amp;TB_iframe=true&amp;height=280&amp;width=680" class="thickbox">
<h3>Si quiere agregar otro relator al listado, haga click aquí</h3>
</a>

<input type="submit" name="enviar" onclick="valida_envia()" value="Enviar inscripción" class="btn btn-primary"
id="enviar">
</div>
</div>

</form>
</div>
</div>

</div>
</div>





This sends it to a php archive where I save the data in the DB:






$curso_nom = mysqli_query($con, "SELECT `nombre_curso` FROM `cursos` WHERE `nombre_curso` = '$nombre_curso'");
echo $curso_nom;

if ($curso_nom == null)
$sql = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `descripcion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', '$descripcion', '$id_relatores', 'si')"); //Se insertan los datos a la base de datos y el usuario ya fue registrado con exito.
/* $sql2 = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', 'dsffs', 'si');"); */

if (mysqli_query($con, $sql))
scriptAlertGo('!El curso fue inscrito correctamente!', '#');

else
scriptAlert('!Ha ocurrido un problema en la inscripción, por favor intente nuevamente!', '#');


else
scriptAlertGo('El nombre del curso ya esta registrado en la base de datos', '#');





The problem is to save the variables of id_relator, since these are listbox with a script in javascript which adds more listbox as the user needs, but when I want to send them to the next php I get the following error:



Notice: Undefined index: relational_id in C: Program Files (x86) EasyPHP5.3.0 www training courses creation_curse_bd.php on line 69



I do not know what the problem may be, if someone can guide me a lot of thanks,










share|improve this question
























  • Did you translate the error message? I don't see relational_id in your sql statement but rather the id_relator field. Do you have a field called like that in your table cursos in the database capacitaciones? Any chance you could make your code wall a bit smaller by providing a [help/mcve] instead, and translating the portugese/Spanish (I don't know) to English (as this can help the ones like me who do not understand your native language)

    – Icepickle
    Mar 9 at 0:06












  • Im sorry, I forgot to translate the variables on the code... id_relator = id_speaker capacitaciones = courses

    – Juan Salinas
    Mar 9 at 12:57













0












0








0








I have a form where I enter the data of a course (name, date, number of hours, speaker...), in which I was asked to add more than one speaker to the course,






<div class="col-md-6 animate-box">
<h3>Complete los datos solicitados</h3>
<form action="creacion_curso_bd.php" method="post" enctype="multipart/form-data" name="form1" target="_self" id="form1">
<div class="row form-group">
<!-- nombre curso -->
<div class="col-md-12">
<input type="text" name="nombre_curso" id="nombre_curso" class="form-control" placeholder="Nombre del curso">
</div>
</div>
<!-- fin nombre curso -->
<input type="hidden" id="dir" name="ip" value="<?php echo $ip_usuario; ?>">
<!-- Podría ser <?=$ip?>, como fomra abreviada -->

<!-- Fecha del curso -->
<div class="row form-group">
<div class="col-md-12">
<!-- <input class="form-control required" type="text" name="check_in" id="check_in" placeholder="Fecha de realización"> -->
<input class="form-control required" type="date" name="fecha_curso" id="fecha_curso" placeholder="Fecha de realización">
</div>
</div>
<!-- fin Fecha del curso -->

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="numero_horas" id="numero_horas" class="form-control" placeholder="Cantidad de horas"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="sigper" id="sigper" class="form-control" placeholder="Codigo SIGPER">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="vacantes" id="vacantes" class="form-control" placeholder="Cantidad de vacantes"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="ubicacion" id="ubicacion" class="form-control" placeholder="Ubicación del curso">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<textarea name="descripcion" id="descripcion" cols="30" rows="20" class="form-control" placeholder="Descripción del curso"></textarea>
</div>
</div>

<!-- ambito -->
<div class="row form-group">
<div class="col-md-12">
<select name="ambito" id="ambito" class="form-control" style="height: 50px">
<option value=''>Elija un ambito</option>
<?php
$query = $mysqli -> query ("SELECT * FROM ambito");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_ambito].'">'.$valores[ambito].'</option>';

?>
</select>
</div>
</div>
<!-- fin ambito -->


<div class="row form-group" id="dynamic_form">
<div class="col-md-12">

<select name="p_name" id="p_name" class="form-control" style="height: 50px">
<option value=''>Elija un relator</option>
<?php
$query = $mysqli -> query ("SELECT id_relator, nombre_relator FROM relatores");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_relator].'">'.$valores[nombre_relator].'</option>';

?>
</select>

<div class="button-group">
<a href="javascript:void(0)" class="btn btn-primary; color: #1f27ba" id="plus5">Añadir mas relatores</a>
<a href="javascript:void(0)" class="btn btn-danger" id="minus5">Remover Relator</a>
</div>

<script>
$(document).ready(function()
var dynamic_form = $("#dynamic_form").dynamicForm("#dynamic_form", "#plus5", "#minus5",
limit: 10,
formPrefix: "dynamic_form",
normalizeFullForm: false
);

dynamic_form.inject([
p_name: 'Hemant',
quantity: '123',
remarks: 'testing remark'
,
p_name: 'Harshal',
quantity: '123',
remarks: 'testing remark'
]);

$("#dynamic_form #minus5").on('click', function()
var initDynamicId = $(this).closest('#dynamic_form').parent().find("[id^='dynamic_form']").length;
if (initDynamicId === 2)
$(this).closest('#dynamic_form').next().find('#minus5').hide();

$(this).closest('#dynamic_form').remove();
);

$('form').on('submit', function(event)
var values = ;
$.each($('form').serializeArray(), function(i, field)
values[field.name] = field.value;
);
console.log(values)
event.preventDefault();
)
);
</script>

<!-- fin prueba dinamica relatores -->
</div>
</div>

<br>
<div class="row form-group">
<div class="col-md-12">

<a href="relatores_embed.php?keepThis=true&amp;TB_iframe=true&amp;height=280&amp;width=680" class="thickbox">
<h3>Si quiere agregar otro relator al listado, haga click aquí</h3>
</a>

<input type="submit" name="enviar" onclick="valida_envia()" value="Enviar inscripción" class="btn btn-primary"
id="enviar">
</div>
</div>

</form>
</div>
</div>

</div>
</div>





This sends it to a php archive where I save the data in the DB:






$curso_nom = mysqli_query($con, "SELECT `nombre_curso` FROM `cursos` WHERE `nombre_curso` = '$nombre_curso'");
echo $curso_nom;

if ($curso_nom == null)
$sql = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `descripcion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', '$descripcion', '$id_relatores', 'si')"); //Se insertan los datos a la base de datos y el usuario ya fue registrado con exito.
/* $sql2 = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', 'dsffs', 'si');"); */

if (mysqli_query($con, $sql))
scriptAlertGo('!El curso fue inscrito correctamente!', '#');

else
scriptAlert('!Ha ocurrido un problema en la inscripción, por favor intente nuevamente!', '#');


else
scriptAlertGo('El nombre del curso ya esta registrado en la base de datos', '#');





The problem is to save the variables of id_relator, since these are listbox with a script in javascript which adds more listbox as the user needs, but when I want to send them to the next php I get the following error:



Notice: Undefined index: relational_id in C: Program Files (x86) EasyPHP5.3.0 www training courses creation_curse_bd.php on line 69



I do not know what the problem may be, if someone can guide me a lot of thanks,










share|improve this question
















I have a form where I enter the data of a course (name, date, number of hours, speaker...), in which I was asked to add more than one speaker to the course,






<div class="col-md-6 animate-box">
<h3>Complete los datos solicitados</h3>
<form action="creacion_curso_bd.php" method="post" enctype="multipart/form-data" name="form1" target="_self" id="form1">
<div class="row form-group">
<!-- nombre curso -->
<div class="col-md-12">
<input type="text" name="nombre_curso" id="nombre_curso" class="form-control" placeholder="Nombre del curso">
</div>
</div>
<!-- fin nombre curso -->
<input type="hidden" id="dir" name="ip" value="<?php echo $ip_usuario; ?>">
<!-- Podría ser <?=$ip?>, como fomra abreviada -->

<!-- Fecha del curso -->
<div class="row form-group">
<div class="col-md-12">
<!-- <input class="form-control required" type="text" name="check_in" id="check_in" placeholder="Fecha de realización"> -->
<input class="form-control required" type="date" name="fecha_curso" id="fecha_curso" placeholder="Fecha de realización">
</div>
</div>
<!-- fin Fecha del curso -->

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="numero_horas" id="numero_horas" class="form-control" placeholder="Cantidad de horas"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="sigper" id="sigper" class="form-control" placeholder="Codigo SIGPER">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="vacantes" id="vacantes" class="form-control" placeholder="Cantidad de vacantes"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="ubicacion" id="ubicacion" class="form-control" placeholder="Ubicación del curso">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<textarea name="descripcion" id="descripcion" cols="30" rows="20" class="form-control" placeholder="Descripción del curso"></textarea>
</div>
</div>

<!-- ambito -->
<div class="row form-group">
<div class="col-md-12">
<select name="ambito" id="ambito" class="form-control" style="height: 50px">
<option value=''>Elija un ambito</option>
<?php
$query = $mysqli -> query ("SELECT * FROM ambito");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_ambito].'">'.$valores[ambito].'</option>';

?>
</select>
</div>
</div>
<!-- fin ambito -->


<div class="row form-group" id="dynamic_form">
<div class="col-md-12">

<select name="p_name" id="p_name" class="form-control" style="height: 50px">
<option value=''>Elija un relator</option>
<?php
$query = $mysqli -> query ("SELECT id_relator, nombre_relator FROM relatores");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_relator].'">'.$valores[nombre_relator].'</option>';

?>
</select>

<div class="button-group">
<a href="javascript:void(0)" class="btn btn-primary; color: #1f27ba" id="plus5">Añadir mas relatores</a>
<a href="javascript:void(0)" class="btn btn-danger" id="minus5">Remover Relator</a>
</div>

<script>
$(document).ready(function()
var dynamic_form = $("#dynamic_form").dynamicForm("#dynamic_form", "#plus5", "#minus5",
limit: 10,
formPrefix: "dynamic_form",
normalizeFullForm: false
);

dynamic_form.inject([
p_name: 'Hemant',
quantity: '123',
remarks: 'testing remark'
,
p_name: 'Harshal',
quantity: '123',
remarks: 'testing remark'
]);

$("#dynamic_form #minus5").on('click', function()
var initDynamicId = $(this).closest('#dynamic_form').parent().find("[id^='dynamic_form']").length;
if (initDynamicId === 2)
$(this).closest('#dynamic_form').next().find('#minus5').hide();

$(this).closest('#dynamic_form').remove();
);

$('form').on('submit', function(event)
var values = ;
$.each($('form').serializeArray(), function(i, field)
values[field.name] = field.value;
);
console.log(values)
event.preventDefault();
)
);
</script>

<!-- fin prueba dinamica relatores -->
</div>
</div>

<br>
<div class="row form-group">
<div class="col-md-12">

<a href="relatores_embed.php?keepThis=true&amp;TB_iframe=true&amp;height=280&amp;width=680" class="thickbox">
<h3>Si quiere agregar otro relator al listado, haga click aquí</h3>
</a>

<input type="submit" name="enviar" onclick="valida_envia()" value="Enviar inscripción" class="btn btn-primary"
id="enviar">
</div>
</div>

</form>
</div>
</div>

</div>
</div>





This sends it to a php archive where I save the data in the DB:






$curso_nom = mysqli_query($con, "SELECT `nombre_curso` FROM `cursos` WHERE `nombre_curso` = '$nombre_curso'");
echo $curso_nom;

if ($curso_nom == null)
$sql = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `descripcion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', '$descripcion', '$id_relatores', 'si')"); //Se insertan los datos a la base de datos y el usuario ya fue registrado con exito.
/* $sql2 = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', 'dsffs', 'si');"); */

if (mysqli_query($con, $sql))
scriptAlertGo('!El curso fue inscrito correctamente!', '#');

else
scriptAlert('!Ha ocurrido un problema en la inscripción, por favor intente nuevamente!', '#');


else
scriptAlertGo('El nombre del curso ya esta registrado en la base de datos', '#');





The problem is to save the variables of id_relator, since these are listbox with a script in javascript which adds more listbox as the user needs, but when I want to send them to the next php I get the following error:



Notice: Undefined index: relational_id in C: Program Files (x86) EasyPHP5.3.0 www training courses creation_curse_bd.php on line 69



I do not know what the problem may be, if someone can guide me a lot of thanks,






<div class="col-md-6 animate-box">
<h3>Complete los datos solicitados</h3>
<form action="creacion_curso_bd.php" method="post" enctype="multipart/form-data" name="form1" target="_self" id="form1">
<div class="row form-group">
<!-- nombre curso -->
<div class="col-md-12">
<input type="text" name="nombre_curso" id="nombre_curso" class="form-control" placeholder="Nombre del curso">
</div>
</div>
<!-- fin nombre curso -->
<input type="hidden" id="dir" name="ip" value="<?php echo $ip_usuario; ?>">
<!-- Podría ser <?=$ip?>, como fomra abreviada -->

<!-- Fecha del curso -->
<div class="row form-group">
<div class="col-md-12">
<!-- <input class="form-control required" type="text" name="check_in" id="check_in" placeholder="Fecha de realización"> -->
<input class="form-control required" type="date" name="fecha_curso" id="fecha_curso" placeholder="Fecha de realización">
</div>
</div>
<!-- fin Fecha del curso -->

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="numero_horas" id="numero_horas" class="form-control" placeholder="Cantidad de horas"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="sigper" id="sigper" class="form-control" placeholder="Codigo SIGPER">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="vacantes" id="vacantes" class="form-control" placeholder="Cantidad de vacantes"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="ubicacion" id="ubicacion" class="form-control" placeholder="Ubicación del curso">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<textarea name="descripcion" id="descripcion" cols="30" rows="20" class="form-control" placeholder="Descripción del curso"></textarea>
</div>
</div>

<!-- ambito -->
<div class="row form-group">
<div class="col-md-12">
<select name="ambito" id="ambito" class="form-control" style="height: 50px">
<option value=''>Elija un ambito</option>
<?php
$query = $mysqli -> query ("SELECT * FROM ambito");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_ambito].'">'.$valores[ambito].'</option>';

?>
</select>
</div>
</div>
<!-- fin ambito -->


<div class="row form-group" id="dynamic_form">
<div class="col-md-12">

<select name="p_name" id="p_name" class="form-control" style="height: 50px">
<option value=''>Elija un relator</option>
<?php
$query = $mysqli -> query ("SELECT id_relator, nombre_relator FROM relatores");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_relator].'">'.$valores[nombre_relator].'</option>';

?>
</select>

<div class="button-group">
<a href="javascript:void(0)" class="btn btn-primary; color: #1f27ba" id="plus5">Añadir mas relatores</a>
<a href="javascript:void(0)" class="btn btn-danger" id="minus5">Remover Relator</a>
</div>

<script>
$(document).ready(function()
var dynamic_form = $("#dynamic_form").dynamicForm("#dynamic_form", "#plus5", "#minus5",
limit: 10,
formPrefix: "dynamic_form",
normalizeFullForm: false
);

dynamic_form.inject([
p_name: 'Hemant',
quantity: '123',
remarks: 'testing remark'
,
p_name: 'Harshal',
quantity: '123',
remarks: 'testing remark'
]);

$("#dynamic_form #minus5").on('click', function()
var initDynamicId = $(this).closest('#dynamic_form').parent().find("[id^='dynamic_form']").length;
if (initDynamicId === 2)
$(this).closest('#dynamic_form').next().find('#minus5').hide();

$(this).closest('#dynamic_form').remove();
);

$('form').on('submit', function(event)
var values = ;
$.each($('form').serializeArray(), function(i, field)
values[field.name] = field.value;
);
console.log(values)
event.preventDefault();
)
);
</script>

<!-- fin prueba dinamica relatores -->
</div>
</div>

<br>
<div class="row form-group">
<div class="col-md-12">

<a href="relatores_embed.php?keepThis=true&amp;TB_iframe=true&amp;height=280&amp;width=680" class="thickbox">
<h3>Si quiere agregar otro relator al listado, haga click aquí</h3>
</a>

<input type="submit" name="enviar" onclick="valida_envia()" value="Enviar inscripción" class="btn btn-primary"
id="enviar">
</div>
</div>

</form>
</div>
</div>

</div>
</div>





<div class="col-md-6 animate-box">
<h3>Complete los datos solicitados</h3>
<form action="creacion_curso_bd.php" method="post" enctype="multipart/form-data" name="form1" target="_self" id="form1">
<div class="row form-group">
<!-- nombre curso -->
<div class="col-md-12">
<input type="text" name="nombre_curso" id="nombre_curso" class="form-control" placeholder="Nombre del curso">
</div>
</div>
<!-- fin nombre curso -->
<input type="hidden" id="dir" name="ip" value="<?php echo $ip_usuario; ?>">
<!-- Podría ser <?=$ip?>, como fomra abreviada -->

<!-- Fecha del curso -->
<div class="row form-group">
<div class="col-md-12">
<!-- <input class="form-control required" type="text" name="check_in" id="check_in" placeholder="Fecha de realización"> -->
<input class="form-control required" type="date" name="fecha_curso" id="fecha_curso" placeholder="Fecha de realización">
</div>
</div>
<!-- fin Fecha del curso -->

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="numero_horas" id="numero_horas" class="form-control" placeholder="Cantidad de horas"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="sigper" id="sigper" class="form-control" placeholder="Codigo SIGPER">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="vacantes" id="vacantes" class="form-control" placeholder="Cantidad de vacantes"
onkeypress="return valideKey(event);">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<input type="text" name="ubicacion" id="ubicacion" class="form-control" placeholder="Ubicación del curso">
</div>
</div>

<div class="row form-group">
<div class="col-md-12">
<textarea name="descripcion" id="descripcion" cols="30" rows="20" class="form-control" placeholder="Descripción del curso"></textarea>
</div>
</div>

<!-- ambito -->
<div class="row form-group">
<div class="col-md-12">
<select name="ambito" id="ambito" class="form-control" style="height: 50px">
<option value=''>Elija un ambito</option>
<?php
$query = $mysqli -> query ("SELECT * FROM ambito");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_ambito].'">'.$valores[ambito].'</option>';

?>
</select>
</div>
</div>
<!-- fin ambito -->


<div class="row form-group" id="dynamic_form">
<div class="col-md-12">

<select name="p_name" id="p_name" class="form-control" style="height: 50px">
<option value=''>Elija un relator</option>
<?php
$query = $mysqli -> query ("SELECT id_relator, nombre_relator FROM relatores");
while ($valores = mysqli_fetch_array($query))
echo '<option value="'.$valores[id_relator].'">'.$valores[nombre_relator].'</option>';

?>
</select>

<div class="button-group">
<a href="javascript:void(0)" class="btn btn-primary; color: #1f27ba" id="plus5">Añadir mas relatores</a>
<a href="javascript:void(0)" class="btn btn-danger" id="minus5">Remover Relator</a>
</div>

<script>
$(document).ready(function()
var dynamic_form = $("#dynamic_form").dynamicForm("#dynamic_form", "#plus5", "#minus5",
limit: 10,
formPrefix: "dynamic_form",
normalizeFullForm: false
);

dynamic_form.inject([
p_name: 'Hemant',
quantity: '123',
remarks: 'testing remark'
,
p_name: 'Harshal',
quantity: '123',
remarks: 'testing remark'
]);

$("#dynamic_form #minus5").on('click', function()
var initDynamicId = $(this).closest('#dynamic_form').parent().find("[id^='dynamic_form']").length;
if (initDynamicId === 2)
$(this).closest('#dynamic_form').next().find('#minus5').hide();

$(this).closest('#dynamic_form').remove();
);

$('form').on('submit', function(event)
var values = ;
$.each($('form').serializeArray(), function(i, field)
values[field.name] = field.value;
);
console.log(values)
event.preventDefault();
)
);
</script>

<!-- fin prueba dinamica relatores -->
</div>
</div>

<br>
<div class="row form-group">
<div class="col-md-12">

<a href="relatores_embed.php?keepThis=true&amp;TB_iframe=true&amp;height=280&amp;width=680" class="thickbox">
<h3>Si quiere agregar otro relator al listado, haga click aquí</h3>
</a>

<input type="submit" name="enviar" onclick="valida_envia()" value="Enviar inscripción" class="btn btn-primary"
id="enviar">
</div>
</div>

</form>
</div>
</div>

</div>
</div>





$curso_nom = mysqli_query($con, "SELECT `nombre_curso` FROM `cursos` WHERE `nombre_curso` = '$nombre_curso'");
echo $curso_nom;

if ($curso_nom == null)
$sql = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `descripcion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', '$descripcion', '$id_relatores', 'si')"); //Se insertan los datos a la base de datos y el usuario ya fue registrado con exito.
/* $sql2 = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', 'dsffs', 'si');"); */

if (mysqli_query($con, $sql))
scriptAlertGo('!El curso fue inscrito correctamente!', '#');

else
scriptAlert('!Ha ocurrido un problema en la inscripción, por favor intente nuevamente!', '#');


else
scriptAlertGo('El nombre del curso ya esta registrado en la base de datos', '#');





$curso_nom = mysqli_query($con, "SELECT `nombre_curso` FROM `cursos` WHERE `nombre_curso` = '$nombre_curso'");
echo $curso_nom;

if ($curso_nom == null)
$sql = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `descripcion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', '$descripcion', '$id_relatores', 'si')"); //Se insertan los datos a la base de datos y el usuario ya fue registrado con exito.
/* $sql2 = ("INSERT INTO `capacitaciones`.`cursos` (`nombre_curso`, `fechas_curso`, `horas_curso`, `id_ambito`, `codigo_sigper`, `vacantes`, `ubicacion`, `id_relator`, `disponible`) VALUES ('$nombre_curso', '$fecha_curso', '$horas_curso', '$id_ambito', '$codigo_sigper', '$vacantes', '$ubicacion', 'dsffs', 'si');"); */

if (mysqli_query($con, $sql))
scriptAlertGo('!El curso fue inscrito correctamente!', '#');

else
scriptAlert('!Ha ocurrido un problema en la inscripción, por favor intente nuevamente!', '#');


else
scriptAlertGo('El nombre del curso ya esta registrado en la base de datos', '#');






javascript php html






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 1:56









cb64

690314




690314










asked Mar 9 at 0:01









Juan SalinasJuan Salinas

1




1












  • Did you translate the error message? I don't see relational_id in your sql statement but rather the id_relator field. Do you have a field called like that in your table cursos in the database capacitaciones? Any chance you could make your code wall a bit smaller by providing a [help/mcve] instead, and translating the portugese/Spanish (I don't know) to English (as this can help the ones like me who do not understand your native language)

    – Icepickle
    Mar 9 at 0:06












  • Im sorry, I forgot to translate the variables on the code... id_relator = id_speaker capacitaciones = courses

    – Juan Salinas
    Mar 9 at 12:57

















  • Did you translate the error message? I don't see relational_id in your sql statement but rather the id_relator field. Do you have a field called like that in your table cursos in the database capacitaciones? Any chance you could make your code wall a bit smaller by providing a [help/mcve] instead, and translating the portugese/Spanish (I don't know) to English (as this can help the ones like me who do not understand your native language)

    – Icepickle
    Mar 9 at 0:06












  • Im sorry, I forgot to translate the variables on the code... id_relator = id_speaker capacitaciones = courses

    – Juan Salinas
    Mar 9 at 12:57
















Did you translate the error message? I don't see relational_id in your sql statement but rather the id_relator field. Do you have a field called like that in your table cursos in the database capacitaciones? Any chance you could make your code wall a bit smaller by providing a [help/mcve] instead, and translating the portugese/Spanish (I don't know) to English (as this can help the ones like me who do not understand your native language)

– Icepickle
Mar 9 at 0:06






Did you translate the error message? I don't see relational_id in your sql statement but rather the id_relator field. Do you have a field called like that in your table cursos in the database capacitaciones? Any chance you could make your code wall a bit smaller by providing a [help/mcve] instead, and translating the portugese/Spanish (I don't know) to English (as this can help the ones like me who do not understand your native language)

– Icepickle
Mar 9 at 0:06














Im sorry, I forgot to translate the variables on the code... id_relator = id_speaker capacitaciones = courses

– Juan Salinas
Mar 9 at 12:57





Im sorry, I forgot to translate the variables on the code... id_relator = id_speaker capacitaciones = courses

– Juan Salinas
Mar 9 at 12:57












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072636%2fhow-do-i-get-2-variables-with-the-same-id-stored-in-a-bd%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072636%2fhow-do-i-get-2-variables-with-the-same-id-stored-in-a-bd%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page