Mazhar Iqbal Rana Mazhar Iqbal Rana - 2 months ago 7
PHP Question

Values of Two Textboxes on Another Page PHP

Good Day,

I have a textbox and I am fetching its value in next page.

Pls see code first below

View.php

echo '<td class="forscreen"><a href="equipments.php?emp_number=' .$row['emp_number'] . '">Add Accessories</a></td>';


When you click add accessories, you get value of emp_number on next page where on next page I have:

<input class="input" type="text" name="emp_numberPrint" id="emp_number" readonly value="<?php echo (isset($_GET['emp_number'])) ? htmlentities($_GET['emp_number']) : ''; ?>"/>


Now, I want the same if I have another textbox named owner and I am trying the below code:

echo '<td class="forscreen"><a href="equipments.php?emp_number=' .$row['emp_number'] .$row['first_name'] . '">Add Accessories</a></td>';

<input class="input" type="text" name="ownerPrint" readonly value="<?php echo (isset($_GET['ownerPrint'])) ? htmlentities($_GET['first_name']) : ''; ?>"/>


Here first_name is to be fetched from last page in same way as emp_number is coming but it is not working,

Surely I am making mistake. Please guide me

Thanks

A J A J
Answer

As per your approach, you have to pass it in query string to get this on next page.

For View.php

echo '<td class="forscreen"><a href="equipments.php?emp_number=' .$row['emp_number'] .'&first_name='.$row['first_name'] . '">Add Accessories</a></td>';

On the next page

<input class="input" type="text" name="ownerPrint" readonly value="<?php echo (isset($_GET['first_name'])) ? htmlentities($_GET['first_name']) : ''; ?>"/>
Comments