Save Data PHP MySQL

Greetings
Could you help me, I have a problem.

I want to receive two values: data1 and data2 from hype and store them in a MySql table.
The routine works, but it only stores blank record in Mysql table.

What am I doing wrong?

Thanks for the help

Screen Hype


Screen PHP
php

Proyect
IngrDat_MySql.zip (126.5 KB)

Chris, Thanks for your help.

The routine works, but you only store 0s in Mysql.

Apparently I am not associating the value entered in Hype with the java variable.
¿ How do you relate Hype's "text input box" to the variable created in the resultsend () function?

My apologies I speak Spanish and my translation may not be the best.

Luis
Chile
South America
Hype_Ingreso.zip (123.2 KB)

Hi Luis,

I think your problem is that you are sending .text to the database when you really need to send .value as your input boxes can be changed.

I've made the changes to the file. Have a go and let me know if it works.

Chris

(Escena1)update.zip (122.1 KB)

Hi Chris
Thanks for your quick response.

I have made the changes, unfortunately it does not work.
Ha through value () does not enter records.
Ha through text () does not enter blank records.

I am attaching the project with a script from the DB, if you have time you could review it.

Thanks for your support.
IngrDat_MySql.zip (312.5 KB)

It looks like you're using jquery; I believe the proper way is to use .val() and not .value() for input elements. Therefore resultsend() would have:

data: {
    dato1: $('#dato1').val(), 
    dato2: $('#dato2').val(), 
},
1 Like

Does this solve your problem Luis?

The other way would be to take the value of your input boxes and place them in a text element but hide this. Then send the text element to the database maybe?

Let me know how you get on

(I've moved the posts from the previous topic over to this one since it is about specific help)

It looks like the problem is that you use a Unique Element ID on the Hype element (dato1 and dato2), and also reuse them in the Inner HTML for the <input> fields. Therefore it is reading the .val() from the Hype element, which is blank. You should only have one unique element ID, so if you just remove them on the Hype element, and leave them on the inner HTML <input>, then it will work.

1 Like

[PROBLEM SOLVED]
I thank Chris and Jonathan for their help.

Apparently the error occurred because type = "text" was not declared in the data entry box.

QUERY
How can I deliver a fixed value has "data2", an example assignment data2 = 1.
Support is appreciated.
Captura de Pantalla 2020-11-30 a la(s) 19.15.46

2 Likes

Glad you figured that out. If you need a fixed value, just put that value exactly where you have the cursor.

data: {
    dato1: $('#dato1').val(), 
    dato2: "my fixed value", 
},

Ok thank you very much

A post was split to a new topic: Clicking a button