Hello,
I have a PHP page that has input text boxes and dropdown menus. Sometimes, users will input data and realize that one of the dropdown menus does not have the data they need. So they will click on a hyperlink next to the dropdown menu, and add it to the MySQL DB.
The problem is, the new data in the MySQL DB which shows up in the dropdown menu does not show up unless the user refreshes the page, but all the data they already put in is lost.
Is there any way to deal with this issue?
Thanks in advance!
How to refresh PHP page with data in fields without submitti
Moderator: General Moderators
-
solarisuser
- Forum Newbie
- Posts: 1
- Joined: Tue Mar 21, 2006 2:00 pm
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
A thread from today.
viewtopic.php?t=45858
viewtopic.php?t=45858
-
gavinandresen
- Forum Newbie
- Posts: 8
- Joined: Tue Mar 21, 2006 8:18 pm
Well... you could use AJAX, but unless you're already using AJAX that would be a ton of work.I have a PHP page that has input text boxes and dropdown menus. Sometimes, users will input data and realize that one of the dropdown menus does not have the data they need. So they will click on a hyperlink next to the dropdown menu, and add it to the MySQL DB.
Can you change the UI a bit? Instead of clicking on a hyperlink next to the drop-down, click on a special selection in the drop-down? E.g. (new value) ? Then if (new value) is set when the form is submitted, give them a form where they can enter the new info and submit it. You could bundle up all the other values from the first form into a hidden field on the second ( htmlspecialchars(serialize($_POST)) would work).
If THAT's too much work, you could keep the hyperlink and have them choose a (new value) selection that just tells your PHP code to re-display the form with all the $_POST'ed values filled in (and the new value from the DB, assuming they followed the hyperlink and added another choice).
This code might be helpful with the re-display the form part of the problem: http://www.onlamp.com/pub/a/php/2006/03 ... forms.html
[/quote]