|
A refresh will resubmit $_POST variables, that if you are using them in your page logic, means the logic will repeat. These values are stored on the users browser so using unset to clear the post variable will do you no good, you need to do 2 things the first is as the other poster says, make certain the information does not already exist. The second is when the data is processed send the user to a specific URL. This will keep the user from refreshing the page and having post vars repeated.
On a side note if you are echoing any information before you redirect the user, they will get a error message (headers already sent or some such). You can fix this with eith redirect by using javascript or you can redign your code to put all the echo'd information into a variable and echo that just after you redirection code.
|
|
|
|
|
I assume you are using an ajax framework which uses iframe to submit your form. In that case you are doing a normal refresh like you press F5. Or if you say that you are using javascript to reload the page like window.location.reload() then you will face that problem whether you are using F5 or reload using javascript. whatever. use window.location.href = window.location.href. this is like assigning a string to as the new url instead of meaning to the browser as reload. so the browser will load the page as a new request instead of page refresh. so we are reassigning a new(same) url (requesting the browser to load that page) instead of requesting the browser to reload the page. so the only difference here is loading a page and reloading a page.
To load a page use window.location.href = window.location.href (new request)
To reload a page use window.location.reload(). (refresh the same)
I suppose that your problem lies within this.
If you are not using ajax then use the redirect option in php to the same controller(page) to change the last loaded url. for example if you are posting your form data to a page called post.php in that after processing the database operation redirect to again the same post.php. by doing so you are changing the last request as a get request. and after that when you refresh the browser will issue a get request and not the previous post request because it will do a reload only with the last request.
DO YOU NEED A SAMPLE CODE?
IF THIS DID NOT SOLVE YOUR PROBLEM THEN USE
INSERT IGNORE INTO table (field1,field2) VALUES(1,2);
Better i should blog this answer with more possible combination.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
I need to color a certain region of the map and for this I need the corner points' latitude and longitude.I am able to find latitude and longitude of any point in the map via the url "http://www.earthtools.org/" but I am not being able to find the corners of any region?for eg. I need to color Stockholm Sweden but I am facing problem with finding the actual border of Stockholm (Sweden) i.e what sub cities are included within Stockholm and what sub cities lies at the border of Stockholm?
Can anybody help me to find the borders of any region?
|
|
|
|
|
Can you elaborate more on your question?
Which API are you using and or from where you are getting Map?
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Use geonames.org
or google.com geocoding.
but you need to do a lot of distance processing and angles with the lat and lng.
Use polyline option in google map or relative to it in your map tool.
That would be interesting. at least for me. haha.
I did plotting of an express bus route in the US map using google map and javascript. Interesting.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
|
I have used PHPFamilyTree but its not good .
Can't I get the 1 I posted
|
|
|
|
|
|
Thank you so much for your kind answer. Now I am posting it in the Collaboration / Beta Testing .
|
|
|
|
|
I'll give you a clue ...
.
.
.
.
.
.
.
.
.
.
.
.
It's a Saturday. CP is nearly always quiet at weekends. So, give it time, somebody somewhere might just take up your ideas, but then again, there may not be much interest in them, who knows! but time will tell.
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Amazing !
I am really impressed by ur answers
THANK YOU !
|
|
|
|
|
its urgent & no on is replying yp there . I am still waiting for somebody to assist
|
|
|
|
|
Noman, if it is that urgent, I suggest you temporarily make do with an existing script or scripts (as suitably modified), as I suggested previously, whilst proceeding to produce the necessary specification and requirements until such time that you are able to start the coding and eventual testing, then, continue to call for collaboration here and elsewhere until such time you have a product that meets your needs. If you are able to design and code, then ask question here if you run into trouble, but don't forget, we here are not mind readers, we need proper information of what might be troubling you. Also remember, any advice sought could potentially take a lot of time for replies to appear, CP is not a paid-for service.
As I suggested above, there may or may not be people interesting in pursuing such a venture, personally, I'm not. However, certainly there are suitably qualified PHP and MySQL database chaps as members here at CodeProject, but, they may already have their time committed elsewhere in both their day job and in their "private" projects, or indeed, with their family commitments.
If you can't get collaborators here or elsewhere and you become desperate, I don't care to suggest these people, but, in your case of "urgency", "RentaCoder", is an option - a poor option - but an option nonetheless.
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Hi All,
Im new (Very New) to PHP. I have created a small script for use on Linux. When the script does certain things it will e-mail a user. Here i what I have so far:
$to = $email;
$subject = "Backup Account Quota Change";
$message = "The Quota for: $username has been changed\nYour new Quota is $quota";
$headers = "From: webmaster@mywebsite.com\r\nReply-To: webmaster@mywebsite.com";
$mail_sent = @mail( $to, $subject, $message, $headers );
echo $mail_sent ? "Mail sent" : "Mail failed";
Now ... How do i get it to use a remote mail server? For example our mail server is 192.168.0.11, and it needs to use a username of script.mail, and password of Password.
Could somebody also give me some idea on if this look ok? Any flaws/comments/suggestions?
Cheers
Si
|
|
|
|
|
|
I'm creating a new program. The ONLY thing which is important for me is the running time of the program. Should I use a regular expressions, or maybe should I write my own search code?
|
|
|
|
|
Stop spamming the forums. The answer is the same everywhere: the running time of the program will be much too long due to the repeated use of the same query expression.
It's time for a new signature.
|
|
|
|
|
If performance is truely the only thing which is important than write your own code.
But really is that all that matters? I think your time is worth a lot more than that. Why not use the regexp tools you have and try it out. My betting is that it will be good enough. But who knows without anything else to go on?
|
|
|
|
|
I'm creating a new program. The ONLY thing which is important for me is the running time of the program. Should I use a regular expressions, or maybe should I write my own search code?
|
|
|
|
|
Read the guidelines. Post your question in ONE forum.
btw, I can't be bothered making this reply to all your identical questions.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I think regular expression will do the trick
|
|
|
|
|
hello guys...i wanted to ask that what sort of application can be built using beagle board(with linux installed on it)?? Using it, can they just be embedded or they can be for a different domain as well (just like the development on Windows using MS Visual Studio)??
|
|
|
|
|
From what I've gathered, the Beagle Board is a single board computer.
Muzammil Saeed wrote: i wanted to ask that what sort of application can be built using beagle board
As seen as the Beagle Board is a computer, your question is the equivalent of saying "What programs can I write for a computer?". Just use your imagination as to what you could write for it?
Unless of course I misunderstand the question.
Programming is 10% science, 20% ingenuity, and 70% getting the ingenuity to work with the science.
WYSIWYMGIYRRLAAGW: What You See Is What You Might Get If You’re Really Really Lucky And All Goes Well.
|
|
|
|
|
Lloyd Atkinson wrote: Unless of course I misunderstand the question.
English is not my first language so hope you don't mind it. It is a single board computer. If I install Ubuntu on it, can we make all the same programs using it, just like we do it using VS 2008 on windows (of course with Mono installed on Ubuntu)??
|
|
|
|
|
Hi
I'm trying to convert a python script from blender to C++. The script is used to import 3D data from a file.
Things have been going right until I got to this part of the script:
# Generate verts and faces lists, without duplicates
verts = []
coords = {}
index = 0
for f in faces:
if f: # Line might be blank
for i, v in enumerate(f):
try:
f[i]= coords[v]
except:
f[i]= coords[v] = index
index += 1
verts.append(v)
Since I don't know python, I need help to interpretate this part of the code.
|
|
|
|