View Full Version : Refreshing and Submit Probs
Ronald Ng
4th Aug 2005, 07:40 pm
1) Is there a way of refreshing a page automatically after submitting a form to change to the database. I have a prob of making a change to the database to find that my change is not there.
I have to refresh the page manually before seeing my changes. Is there some PHP code (that's what i'm familar with ) that refreshes the page when u submit a form?
2) Also I'm having a problem with submitting forms. When I click the button or select the button using 'tab' and press enter the form works.
But if I enter data in a form and press 'enter' directly the form does not process properly.
Is there a way of automatically 'tabbing' a submit button.
francis
4th Aug 2005, 08:53 pm
Hi
The first one sounds like you might need a self-referring form - the form sends itself to itself when it's submitted and, depending on whether it's been loaded for the first time or whether it's been submitted it does different things. If you've not coded one of these before, I can send you the code for the Bentley School contact form that was self referring. I think that will help.
The second one I'm not entirely sure what you mean. The default action of a form is to submit if a user presses enter in something like a text field (but not a <textarea>). Can you put a page up online somewhere so that I can see it. Also, if you can try and explain "automatically tabbing a submit button", that'd really be a help. I've done loads of stupidly complex form validation at work, so this should (I hope) be straight forward.
Ronald Ng
4th Aug 2005, 09:36 pm
Yes thanks for that Francis. I really appreciate ur comments.
Regarding:-
1) Yes I have used self referring forms. But its just when i navigate away to say the homepage i don't see the changes automatically. I have to refresh. I don't mind but i'm doing this for a friend and he finds this annoying.
2) http://www.ronaldng.co.uk/website_review/search.php
If you enter a search into the Keyword field and press 'Enter' with the keyboard, in internet explorer anyway nothing happens. But if u click on the button, with ur mouse it works!
It also works if u enter something into 'Keywords' press tab until the Submit button is selected and press 'Enter'.
This is not an isolated thing. It happens to me b4.
francis
4th Aug 2005, 10:26 pm
Ah, right. Okay, well the first one is actually solved by doing something like adding a no-cache header to your page, either by using PHP or by using an HTML meta tag. Be careful, though as there are 2 versions of no cache - I think the "pragma" one is M$ only, so you don't want that. A look around Google or PHP's headers section should get you what you need. The no-cache will forbid the browser from storing a local copy of the page - this will mean more server load as the server will have to, well, serve, a page every single time, but I guess we're not talking about gigs of bandwidth here.
As for the second one, well, the form works as I'd expect in Safari and Firefox (sorry, no IE - my Windows machine has been gathering dust for several months - I need to fire it up when my thesis needs it, but that's it). The only thing in your code that I can see that needs fixing is that your form needs an action - maybe that's what IE wants. You've got:
<form name="form1" method="post" action="">
You need a URL in the action bit. If it's self referring, just bung $_SERVER["PHP_SELF"] into there and that should echo out the page's URL. If that doesn't work, let me know and, if I can make some time available, I'll try it at work tomorrow.
PS - that's a whole lot of presentational HTML that you could strip out into CSS - all those <hr>s could be borders, for example.
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.