[PHP] Wont Submit data to DB

Shxrty

Shorty#1960
Mar 31, 2018
629
163
Hiya DevBest,

Lately i have been working on a portal for a project that im working on, it involves a logging system to log something.

my issue:

its for a Habbo Agency. They want to log the people who got payed, how much, and who paid. Now i got the form and the submit working but not fully, I have a submit.php which send the log to the database but it doesn't send it to the database.

 

Shxrty

Shorty#1960
Mar 31, 2018
629
163
Can you provide some code? The screencapture is great but tells us nothing
Sure.

I hid the database info, at the top of the page i have
include('../api/includes/submit.php');
 

Shxrty

Shorty#1960
Mar 31, 2018
629
163
tried this and did it with method="get" instead because thats what it seemed to work with rather than post; moral of this is that it didn't work.
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
You are using $_POST on your server, which means your form should do a POST request.

A few other things I am going to point out:

1) Your table should be normalized. You are storing data in here multiple times. What happens if someone changes their username?

Table 1: Associated_Users
[ID] [USERNAME]

Here you can change the username column without affecting the other tables

Table 2:
[ID] [PAID_ASSOC_USER] [PAYEE_ASSOC_USER] [MESSAGE]


Sample Records would be:

Table 1-
[1] [Revali]
[2] [Caitlin]
[3] [Jess!]
[4] [Nick]

Table 2-
[1] [1] [3] [20SC and 2T] (Jess paid Revali)
[2] [2] [3] [20 SC and 2T] (Jess paid Caitlin)
[3] [2] [4] [4t/5sc] (Nick paid Caitlin)

If you change your posts to $_GET[''] and then you do a URL request by doing:
submit.php?name=Test&message=Testing&payee=Test2

Does it add it to the record? My suggestion is to get it working with the GET request, then swap them to POST, if it doesn't work it's an issue with ur form.

On your PHP side, I would like to see the full PHP code as well. There is no brackets, which means if you load this page up it's going to execute regardless if you have submitted the form or not, and ur not checking if those values are set or verifying the inputs before you use them. You're not sanitizing them either.
 

Attachments

  • 1608834780356.png
    1608834780356.png
    3.1 KB · Views: 4

Shxrty

Shorty#1960
Mar 31, 2018
629
163
You are using $_POST on your server, which means your form should do a POST request.

A few other things I am going to point out:

1) Your table should be normalized. You are storing data in here multiple times. What happens if someone changes their username?

Table 1: Associated_Users
[ID] [USERNAME]

Here you can change the username column without affecting the other tables

Table 2:
[ID] [PAID_ASSOC_USER] [PAYEE_ASSOC_USER] [MESSAGE]


Sample Records would be:

Table 1-
[1] [Revali]
[2] [Caitlin]
[3] [Jess!]
[4] [Nick]

Table 2-
[1] [1] [3] [20SC and 2T] (Jess paid Revali)
[2] [2] [3] [20 SC and 2T] (Jess paid Caitlin)
[3] [2] [4] [4t/5sc] (Nick paid Caitlin)

If you change your posts to $_GET[''] and then you do a URL request by doing:
submit.php?name=Test&message=Testing&payee=Test2

Does it add it to the record? My suggestion is to get it working with the GET request, then swap them to POST, if it doesn't work it's an issue with ur form.

On your PHP side, I would like to see the full PHP code as well. There is no brackets, which means if you load this page up it's going to execute regardless if you have submitted the form or not, and ur not checking if those values are set or verifying the inputs before you use them. You're not sanitizing them either.
People cant change there username on the panel else; they would have to contact me to change it for them. Its currently hosted on cPanel and am willing to give ya the login to the panel if you wish so you can look yourself, i am going to try the $_GET method soon!
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
People cant change there username on the panel else; they would have to contact me to change it for them. Its currently hosted on cPanel and am willing to give ya the login to the panel if you wish so you can look yourself, i am going to try the $_GET method soon!
So when they contact u to change it and their username is in over 1000 records , you will update those manually then?
 

Shxrty

Shorty#1960
Mar 31, 2018
629
163
So when they contact u to change it and their username is in over 1000 records , you will update those manually then?
No, when a payee submits there form they have to put there user, because soon ill add a approved/denied section of what was approved or denied.
 

Users who are viewing this thread

Top