Skip to content
Advertisement

PHP update record button not passing information to another page

im trying to make a update record button on php that when clicked, it’ll take you to another page showing only the information of the patient which update button was pressed. Im using the following to show the patient information along with an update button for each patient

patients.php

When I click the update button I want it to take me to another page, which has the following code

patientEdit.php

What I want to happen on this pages is to show the information of only the patient that was on the row where I clicked the update button, I also have a textbox where I would like to display the current email on the database so they can change it if necessary and not sure if that is the correct way to do it.

Right now, the page only shows the table headers with no info, I tried putting “” on patientID as shown below but no result.

Also tried changing the query on patientEdit.php to

Also, nothing happened.

Any help would be appreciated, if more info is needed ill be glad to provide it.

Advertisement

Answer

Change this:

To this:

However, if your ‘Update’ button is only there to navigate to the edit form, it should probably just be a link (<a href="patientEdit.php?pid=YOUR_PATIENT_ID">). You then read out $_GET['pid'] in patientEdit.php instead. See also When do you use POST and when do you use GET?.

The reason behind your initial error is that variables will not be expanded inside single quoted strings. Consider the following to demonstrate:

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