Gideon_1 15 Junior Poster

@Stephano, from what you are saying it means that every thing is okay with the database connection. If so, then can you check your logic well. Sometimes it happens when dealing with especially logical operators.

Stephano commented: hows that done +0
Gideon_1 15 Junior Poster

Hello Mohammed, helping people is the job of a forum, but you need to show us your efforts first. With your codes we will help you find your way out of the concerned problem.

Gideon_1 15 Junior Poster

Check simple mvc tutorials from Alex Garrett at phpacademy on youtube.

Gideon_1 15 Junior Poster

I think you have an issue with the uploads. try changing this

$csvFile1 = $_FILES["file1"];

to

$csvFile1 = $_FILES["file1"]["tmp_name"];

Gideon_1 15 Junior Poster

@jollydd, you sql is not working because you are running php codes in it.

Follow pritaes tutorial and run that sql in phpMyadmin. By the way mysql is deprecated try to use PDO or Mysqli

diafol commented: Deprecated. Why do these people insist on using MySQL functions? +15
Gideon_1 15 Junior Poster

I totally agree with jkon, OOP is OOP in your style. But there are a few things you should also know which will help in your life of programming. This include errors you made in both PHP and HTML. (NOTE: reference XHTML, PHP5 and My Personal Interests).

  1. The inclusion of the class in the same file as other php and html codes does not encourage the idea of OOP. Usually create a file to contain only the Class or group of classes, then you include them on the page they will be needed. You can also use spl_autoload to load your classes without having to include them one by one.

  2. In your if statement, the codes should have been in parenthesis which shows that if the condition is correct run this specific codes.

  3. HTML attributes should have their values placed in double quotation marks. You did some right and left a massive number of them. I recommend you to do that if you want your projects to be of the W3C standards.

  4. You could have made your codes shorter and more readable by making the width and length arguments or parameters of the methods of the class. (Personal Preference).

  5. Indenting of codes is a good practice if you want to become an elite programmer. Always indent your codes to produce neat work.

  6. I don't know how you understand labels and their ids. The label id must be equal to the input field's id. (The field you want to address the …

Gideon_1 15 Junior Poster

Can you show us the codes you have so far.

Gideon_1 15 Junior Poster

Yh, also using WYSIWYG won't help you when it comes to maintaining your codes and debugging.

Gideon_1 15 Junior Poster

Its my passion. I love to program for hours and burn candles at night for nothing but just pleasure. I love programming.

Gideon_1 15 Junior Poster

First of all, why are you using two database connection layers in one script; mysql and mysqli. Please, I encorage you to use mysqli since mysql is deprecated.

Also I think you should be precise of the form method you are using so that you don't just use $_GET or $_POST.

But to your question, it seems you are updating the table against a field called req_code. I will advise you to update your database tables using primary keys (usually id's are used as primary keys in the database).

In your example, it can be possible that, that req_code is the same across all fields in the database. But for id's (primary key), it can never be the same.

So if you don't have an id or primary key field, you go ahead and create one and then update your rows where id = userid.

Gideon_1 15 Junior Poster

Yh I agree with todyITguy, learning it will be of great help but if you are in need seriously you can use these ajax codes;

        <script type="text/javascript">
            function load () {
                var xmlhttp = new XMLHttpRequest ();

                xmlhttp.onreadystatechange = function () {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                        document.getElementById('ajax').innerHTML = xmlhttp.responseText;
                    }
                }

                xmlhttp.open ('GET', 'your_php_file.php', true);
                xmlhttp.send ();
            }
        </script>

Here, you can change the php file url to a get method by getting the values of the input fields you will use for the query. Here you will use something like

`'your_php_file.php?value1='.document.getElementById('input_field1_id').value.'&value2='.document.getElementById('input_field2_id').value`

So the onchange event will send the input fields asynchronously to the php file which will perform the query and send it back to the current page.

So don't forget to create an empty div with the id ajax or anything but i prefer using ajax.

so on the php file you get the values with the $_GET superglobal

so

    $value1 = $_GET['value1'];
    $value2 = $_GET['value2'];

and then you do your query. Everything you echo out or display will be displayed in the ajax div on the current page.

Gideon_1 15 Junior Poster

yh, and assigning all these html to one variable is a really bad practise

tobyITguy commented: yeah true. +0
Gideon_1 15 Junior Poster

@Stephano: not working in what sense. Is the form still submitting only three fields or not working at all.

Stephano commented: yes it is still submitting 3. iam realy not sure why at this point. +0
Gideon_1 15 Junior Poster

in the $SQL you just gave only four fields to be INSERTED so its either

  1. You delete the NULL from the VALUES so

    $SQL = "INSERT INTO safaris8_wo5946.wp_vkfj_users (user_login, user_pass, user_email, user_phone)
    VALUES ('$username', '$password', '$email','$phone')"

  2. Or you add the id field to the fiedls to be updated so

    $SQL = "INSERT INTO safaris8_wo5946.wp_vkfj_users (id, user_login, user_pass, user_email, user_phone)
    VALUES ('$username', '$password', '$email','$phone')"

Stephano commented: not working, still. i replaced this with what i had but still not working. this form is in a wordpress website. +0
Gideon_1 15 Junior Poster

Really, I thought here is a forum which help solve problems but not generating codes for people. But by the way you can show us what you have done, so maybe we can continue it for you.