Jump to content

ovi_gm

New Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ovi_gm

  • Rank
    Newbie
  1. Well, I researched today for hours and I couldn't find any solution to the problem. There are some solutions with an IF statement that seem to be very logical but they don't work. It just doesn't execute the if statement. if( isset($_POST) ) { //submit data to MySQL } By the way. Is there anything simple that I could write so that I know if an IF statement works or not? For example like a beep or something? Just to check if the code gets to a certain point or not...
  2. Shouldn't there be a line in the PHP code that tells it to run when the submit button is clicked? Something's missing. I have many pages on this site. If I click on another page and then come back to this page, there is an empty record added to the database. And it makes sense to be like this because there is a php code that gets executed every time the page is loaded. I'm really stuck here....
  3. Ok. Schema is very simple. It is a database with a single table named contacts. The table has 2 columns: a primary Key ID and a name. I simplified it for the purpose of this topic. When I access my bootstrap modal, I enter for example name "Jim" in the input box. Then I click Submit. Then I have a new record in the database with ID 1 (or whatever is incremented). Now, everytime I refresh my page and do nothing else, there is a new record in the database with the new incremented ID and the same name (Jim). My logic says that php code is running everytime I hit reload. Otherwise, I don
  4. I know what you mean. Still, it doesn't seem right to me. You should be able to somehow execute that php ONLY when the submit button is pressed. What if I don't care if there are 2 or more contacts with the same name? It could be many identical entries only with the ID being different.
  5. Thank you very much for your time to write this message. The fact is that this is how I did it first, with the code on the same page, but I got items added to the database every time I did a refresh which is not ok. This is my code (I am writing only what is essential). I modified it like there's a single column in the database table (named "name"). <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <!-- Bootstrap core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" ty
  6. Hello everyone, I am new to php and I need a confirmation if this is the correct approach for a code I wrote. Basically, I have a contacts.php page where I have a bootstrap table and a modal with some fields to add a new contact. I managed to write all the code, it works perfect but I want to know if this approach is ok. The application will be much more complex and I don;t want to start on the wrong foot here. I have 2 files: contacts.php and add_new_contact.php. First file, contacts.php: <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <!-- ........
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.