Чтобы передать данные из формы 1 в форму 2, а затем включить данные, представленные в форме 1, а также в отправку формы 2, необходимо:
- Передать данные из формы 1 в форму 2(что вы в настоящее время делаете правильно)
- Включите данные из формы 1 также в форму 2 в скрытых вводах (преобразование ввода пользователя в html-объекты во избежание проблем с безопасностью)
Также, пожалуйста,обратите внимание, что вам не нужно создавать входные данные с type="text"
, а затем использовать style="display:none;"
.Вы можете просто создать вход с помощью type="hidden"
, и он будет автоматически скрыт для пользователя браузером следующим образом:
<input type="hidden" name="how_long_do_you_need_the_loan_for" value="<?= htmlspecialchars($_POST['how_long_do_you_need_the_loan_for'])?>" />
В вашем случае форма 2 должна выглядеть следующим образом:
<form action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="how_long_do_you_need_the_loan_for" value="<?= htmlspecialchars($_POST['how_long_do_you_need_the_loan_for'])?>" />
<div id="msform">
<!-- progressbar -->
<ul id="progressbar">
<li class="active"></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<!-- fieldsets -->
<fieldset>
<!-- Success message -->
<h1 style="color: #87C550;
font-size: 25px;
line-height: 50px;
font-family: 'Ubuntu';
font-weight: 700;">
<?php
if(isset($success)){
echo $success;
}
if(isset($error)){
echo $error;
}
?>
</h1>
<h2 class="fs-title">Get an Easy Access to Funding</h2>
<h3 class="fs-subtitle">Are you trading for at least 6 months?</h3>
<p class="comfmsg1"></p>
<div class="form_radio_button_custom_two">
<input type="radio" name="trading_for_at_least_6_months" value="Yes" id="6_months_yes"/>
<label for="6_months_yes" style="padding: 20px 80px !important;">Yes</label>
</div>
<div class="form_radio_button_custom_two">
<input type="radio" name="trading_for_at_least_6_months" value="No" id="6_months_no"/>
<label for="6_months_no" style="padding: 20px 80px !important;">No</label>
</div>
<input type="button" name="next" class="next_extra_per comfnext1 action-button" value="Next" />
</fieldset>
<fieldset>
<br>
<br>
<br>
<h3 class="fs-subtitle">Do you have a revenue of minimum $10,000 per month?</h3>
<p class="comfmsg2"></p>
<div class="form_radio_button_custom_two">
<input type="radio" name="revenue_of_minimum_10000" value="Yes" id="revenue_minimum_yes"/>
<label for="revenue_minimum_yes" style="padding: 20px 80px !important;">Yes</label>
</div>
<div class="form_radio_button_custom_two">
<input type="radio" name="revenue_of_minimum_10000" value="Yes" id="revenue_minimum_no"/>
<label for="revenue_minimum_no" style="padding: 20px 80px !important;">No</label>
</div>
<input type="button" name="next" class="next_extra_per comfnext2 action-button" value="Next" />
<input type="button" name="previous" class="previous_extra_per previous action-button" value="Back" />
</fieldset>
<fieldset>
<br>
<br>
<br>
<h3 class="fs-subtitle">Is this loan going to be used for any business purpose?</h3>
<p class="comfmsg3"></p>
<div class="form_radio_button_custom_two">
<input type="radio" name="used_for_any_business_purpose" value="Yes" id="business_purpos_yes"/>
<label for="business_purpos_yes" style="padding: 20px 80px !important;">Yes</label>
</div>
<div class="form_radio_button_custom_two">
<input type="radio" name="used_for_any_business_purpose" value="Yes" id="business_purpos_no"/>
<label for="business_purpos_no" style="padding: 20px 80px !important;">No</label>
</div>
<input type="button" name="next" class="next_extra_per comfnext3 action-button" value="Next" />
<input type="button" name="previous" class="previous_extra_per previous action-button" value="Back" />
</fieldset>
<fieldset style="width:100%;">
<h2 class="fs-title">Get an Easy Access to Funding</h2>
<h3 class="fs-subtitle">How long are you in the Business?</h3>
<p class="comfmsg4"></p>
<div class="form_radio_button_custom_two">
<input type="radio" name="how_long_are_you_in_the_business" value="Less than 6 months" id="less_than_6_months" />
<label for="less_than_6_months" style="padding: 20px 5px !important;">Less than 6 months </label>
</div>
<div class="form_radio_button_custom_two">
<input type="radio" name="how_long_are_you_in_the_business" value="6-12 months" id="6_12_months"/>
<label for="6_12_months" style="padding: 20px 5px !important;">6-12 months</label>
</div>
<div class="form_radio_button_custom_two">
<input type="radio" name="how_long_are_you_in_the_business" value="less than 1 year" id="less_than_1_year"/>
<label for="less_than_1_year" style="padding: 20px 5px !important;">less than 1 year</label>
</div>
<div class="form_radio_button_custom_two">
<input type="radio" name="how_long_are_you_in_the_business" value="More than 1 year" id="more_than_1_year"/>
<label for="more_than_1_year" style="padding: 20px 5px !important;">More than 1 year</label>
</div>
<input type="button" name="next" class="next_extra_per comfnext4 action-button" value="Next" />
<input type="button" name="previous" class="previous_extra_per previous action-button" value="Back" />
</fieldset>
<fieldset>
<h3 class="fs-subtitle">What is your First Name?</h3>
<p class="msgc5"></p>
<input type="text" name="con_name" class="text_input" id="error5">
<br />
<!-- Button Next/Back -->
<input type="button" name="previous" class="previous action-button" value="Back" style="margin-left: 28%;"/>
<input type="button5" name="next" class="next5 action-button" value="Next" style="margin-right: 28%;" />
</fieldset>
<fieldset>
<h3 class="fs-subtitle">Your Phone Number</h3>
<p class="msgc6"></p>
<input type="text" name="con_phone" class="text_input" id="errorc6">
<br />
<!-- Button Next/Back -->
<input type="button" name="previous" class="previous action-button" value="Back" style="margin-left: 28%;"/>
<input type="button" name="next" class="nextc6 action-button" value="Next" style="margin-right: 28%;" />
</fieldset>
<fieldset>
<h3 class="fs-subtitle">Your Email Address</h3>
<p class="msgc7"></p>
<input type="email" name="con_email" class="text_input" id="errorc7">
<br />
<!-- Button Next/Back -->
<input type="button" name="previous" class="previous action-button" value="Back" style="margin-left: 28%;"/>
<input type="button" name="next" class="nextc7 action-button" value="Next" style="margin-right: 28%;" />
</fieldset>
<fieldset>
<h3 class="fs-subtitle">What is the Business Trading Name?</h3>
<p class="msgc8"></p>
<input type="text" name="trading_name" class="text_input" id="errorc8">
<br>
<!-- Button Next/Back -->
<input type="button" name="previous" class="previous action-button" value="Back" style="margin-left: 28%;"/>
<input type="button" name="next" class="nextc8 action-button" value="Next" style="margin-right: 28%;" />
</fieldset>
<fieldset>
<h3 class="fs-subtitle">What is Your Address?</h3>
<p class="msgcb"></p>
<input type="text" name="your_address" class="text_input"id="errorcb">
<br>
<!-- Button Next/Back -->
<input type="button" name="previous" class="previous action-button" value="Back" style="margin-left: 28%;"/>
<input type="submit" name="con_submit" class="submit action-button" value="Submit" style="margin-right: 28%;" />
</fieldset>
<div>
</form>