2
I’m a beginner in PHP and I’m struggling to find a solution to my problem. I have a array main with 7 arrays, with 2 fields each, which are tabs on one of the urls of the site.
I need that when clicking the 'next step' button be redirected to the second tab, but I could not even do json or by javascript. Someone can help me?
Below is part of the code.
$topicos = array(
array(
"id" => 1,
"label" => "Formação"
),
array(
"id" => 2,
"label" => "Cursos Extra Curriculares"
),
array(
"id" => 3,
"label" => "Experiências Profissionais"
),
array(
"id" => 4,
"label" => "Experiências Internacionais"
),
array(
"id" => 5,
"label" => "Idiomas"
),
array(
"id" => 6,
"label" => "Conhecimentos Técnicos Específicos"
),
array(
"id" => 7,
"label" => "Outras Informações"
)
);
<form action="<?= $path ?>banco_de_talentos_add_2" id="segundo_formulario" method="post" enctype="multipart/form-data">
<input type="hidden" id="proxima" name="proxima" value="0"/>
<div class="row-fluid ">
<div class="span12">
<div class="dropdown_protect"></div>
<div class="tab-header">
<ul id="tab-content" class="nav nav-tabs classe_a_ocultar_em_smartphone classe_a_ocultar_em_tablet">
<?php
foreach ($topicos as $t):
if($t["id"] == 1):
echo "<li class='active'><a href='#tab" . $t["id"] . "'>" . $t["label"] . "</a></li>";
else:
echo "<li><a id='ir_para_questionario' href='#tab" . $t["id"] . "'>" . $t["label"] . "</a></li>";
endif;
endforeach;
?>
</ul>
</div><!--tab-header-->
<div class="tab-content">
<?php foreach($topicos as $t):
if($t["id"] == 1):
echo '<div id="tab' . $t["id"] . '" class="tab-pane active">';
else:
echo '<div id="tab' . $t["id"] . '" class="tab-pane">';
endif;
include "banco_de_talentos_formulario_" . $t["id"] . ".php";
echo '</div>';
endforeach; ?>
</div>
</div>
</div>
<div style="width:100%;text-align:center">
<input type="submit" value="Salvar" class="btn"/>
<input type="button" id="btn_anterior" value="Etapa Anterior" class="btn" onClick="document.getElementById('proxima').value = 2; document.getElementById('segundo_formulario').submit()"/>
<input type="button" id="btn_proxima" value="Próxima Etapa" class="btn" onClick="document.getElementById('proxima').value = 1; document.getElementById('segundo_formulario').submit()"/>
<!-- <input type=button value="Proxima aba" class="btn" id="new_tab" onkeydown="tab()"> -->
</div>
Thanks, but I need to put this change of tabs for the onclick event on the next step button. Every time I click the next step button, it redirects to the next tab. You could help me?
– Rafael Wertz
So it’s the same idea...
– Diego Souza
I used the same idea, only changing to the names of the classes I have, but still could not. On another page of the site, it was done the same thing, only with two tabs, I click the button and redirect to another tab...
– Rafael Wertz