Mysql query, two times?
Posted on
16th Feb 2014 07:03 pm by
admin
Hello to all,
I'm new to php coding and i like it alot. I need help with some noob stuff.
1. Having problem with mysql query after submiting HTML form. It's allways execuding two times, that way i have two identical data in table which i do not wont.
HTML code:
Code: [Select]<form name="kluboviForm" method="post" action="kluboviAction.php">
<input name="predsjednik" type="text"/>
<input name="email" type="text"/>
<input name="kontakt" type="text"/>
<input name="sjedisteKluba" type="text"/>
<input name="imeKluba" type="text"/>
<input type="Submit"/>
</form>
PHP code (kluboviAction.php):
Code: [Select]<?php
mysql_connect(localhost,root,'');
mysql_select_db(ljestvica) or die( "Unable to select database");
mysql_query("INSERT INTO klubovi VALUES ('','a','b','c','d','e')");
mysql_close();
?>
After execuding the submit button on form i get this error in google chrome:
Error 101 (net::ERR_CONNECTION_RESET): Unknown error.
But the query is execudet and table is filed with two identical informations.
2. Is there a way to put php function inside action form? I wont to execude php function after someone submits the form. I wont to delete kluboviAction.php file and use function to put the information in to database without the need to use second file. If there is anothere way to do that please let me know.
3. How to redirect URL after execuding submit button to not show message above?
Any help would be appreciated.
Thanks
No comments posted yet
Your Answer:
Login to answer
105
43
Other forums
Must be a string? Huh, what? HELP?
with the following script, I get
Fatal error: Property name must be a string in /home/content/e/
Session problem?!?
Hello All! I am very new to the php world but I am working on fixing things that a previous programm
Convert array to string and write to csv file
I am looking to write a MySQL query to a csv file.
At the minute I:
check for the orig
Oracle Text CTX_DOC.snippet slow
I have a table (FILE_TABLE) that contains a blob column (ft_file) and I have created the following O
Doubles are giving me problems
Ok so, first of all i made a double = 0.05, but when running the debugger it shows up as 0.04999. I
Get dump of MySQL DB from Live Site
I'm after an easy, but secure way of generating and importing a MySQL dump from a remote server.
Forms Authentication and Refresh at Login page
Hello,
When I try to press the Login button in my webapplication at my login.aspx page nothing h
Display certain image depending on time of year
Hi, I am new to these forums and would really appreciate some advice on a piece of coding I have don
FILTER_CALLBACK -- Files?
Hi All,
I'm using the php filter functions to validate my form data. For custom filters, I'm
having probem inserting data into db table
hi
i have a table with following columns in it
Code: candidate_id, degree, cgpa, institute