I am having trouble with mysql and php.
The mysql is fine, when I insert a row in php my admin it works.
In my php script, I made a script that works fine, but I also have a script that just runs ONCE. For some reason the query is being inputted twice or something.
I've tried everything. Has anyone heard of a problem like this before, and do any solutions come to mind?
Thanks
Cameron
php script keeps submitting 2 rows into database
Moderator: General Moderators
OK!!! I FIGURED IT OUT!!! BUT WHY!!!!!!!!!!!!!!!!!!!!!!!!!!
Heres the thing. I had a form, but I also had a new button right next to it.
I used a form button as my html button.
<input type="button" name="submitButtonName" />
I put a link around that button (and put a lable in it) for my button. For some reason, and it just hit me now, that button was submitting everything twice. My delete script was going wacko too. Now it works fine.
So does anyone know why this happened?
Thanks
Cameorn
Heres the thing. I had a form, but I also had a new button right next to it.
I used a form button as my html button.
<input type="button" name="submitButtonName" />
I put a link around that button (and put a lable in it) for my button. For some reason, and it just hit me now, that button was submitting everything twice. My delete script was going wacko too. Now it works fine.
So does anyone know why this happened?
Thanks
Cameorn
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
The buttons werent in a form, they were just links.
They linked to a page new.php and delete.php that just getnerated new entries or moved old ones to the trash.
but it seems when i turned that button into text, the double submit didnt happen anymore.
Heres the weird thing
The form button some times ran the script twice, but also, sometimes it ran it once.
But for anyone coding php scripts, never make your button a form button!!
They linked to a page new.php and delete.php that just getnerated new entries or moved old ones to the trash.
but it seems when i turned that button into text, the double submit didnt happen anymore.
Heres the weird thing
The form button some times ran the script twice, but also, sometimes it ran it once.
But for anyone coding php scripts, never make your button a form button!!