I have two tabs "personal info" and "Address info" section under personal details. First I am filling the personal info section and click on save button. It should then save data in the database and need to redirect to "Address info" tab. I tried it but it is not working.
Here is my code:
<ul class="nav nav-tabs">
<li><a href="#personalinfo" data-toggle="tab">A.PERSONAL INFO</a></li>
<li><a href="#address" data-toggle="tab">B.ADDRESS</a></li>
</ul>
<li class="tab-pane active" id="personalinfo">
<form method="post" action="personal.php" id="myform">
<input type='hidden' value="<?php echo $username; ?>" name='email'>
<table>
<th>
First Name
</th>
<td>
<input type="text" name="first_name" value="" />
</td>
<th>
last Name
</th>
<td>
<input type="text" name="last_name" value="" />
</td>
</li>
</form>
<li style="list-style: none"><a href="#address" data-toggle="tab" id="submit">Save</a></li>
<li class="tab-pane" id="address">
<form method="post" action="address.php" id="myform">
<input type='hidden' value="<?php echo $username; ?>" name='email'>
<table>
<th>
Address
</th>
<td>
<input type="text" name="address" value="" />
</td>
<th>
Pincode
</th>
<td>
<input type="text" name="pincode" value="" />
</td>
</li>
<button type="submit" class="medium" style="background-color: #2daebf;">
Save</button>
</form>
答案 0 :(得分:1)
如果您一遍又一遍地使用用户信息。我建议你使用会话。 将用户信息保存在会话的参数中,例如$ _SESSION [&#39;用户名&#39;]或$ _SESSION [&#39; age&#39;]或您使用的其他内容。
答案 1 :(得分:0)
您可以将您的按钮类型从提交更改为简单按钮,并使用jquery提交表单,然后单击按钮并使用ajax,然后重定向到您要去的网址。
<button type="button" id="submit_btn" class = "medium" style="background-color: #2daebf;">Save</button>
用于使用ajax
提交表单的Jquery代码$("#myForm").ajaxSubmit({url: 'url', type: 'post'});
window.location.href = "next_url";
答案 2 :(得分:0)
在sesion中创建一个布尔值,首先隐藏地址选项卡,然后显示个人选项卡。提交个人信息后,更改布尔值并显示地址选项卡并隐藏个人选项卡