Skip to content
Advertisement

how to get data from another form

I have three forms which are homeUser.php, application.php, and payment.php. in homeUser.php I have this information with form details.

<input type="number" class="form-control" id="numApplicant" name="numApplicant" placeholder="Total Applicant" /><br />
</div></div></div>
                    
<div class="input-group form-group">
    <div class="input-group-prepend">
        <span class="input-group-text"><i class="fas fa-thumbtack"></i></span>
        <input type="radio" class="form-group" id="location" name="location" <?php if (isset($location) && $location=="Location A") echo "checked";?> value="Location A">Location A
        <input type="radio" class="form-group" id="location" name="location" <?php if (isset($location) && $location=="Location B") echo "checked";?> value="Location B">Location B
        <input type="radio" class="form-group" id="location" name="location" <?php if (isset($location) && $location=="Location C") echo "checked";?> value="Location C">location C                     
    </div>
</div>

So in form application.php, I can retrieve the id by using the code

<?php
 echo $_POST['numApplicant'];
 echo $_POST['location'];?>

However, I want to use the numApplicant and location in the third form also. how should I call it in the third form?

Advertisement

Answer

Two options.

1: Store in sessions 2. Have hidden fields on your subsequent forms and _POST the data into these, they’ll get reposted on each step.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement