I don't know why this is happening, so I decided to ask you, guys :)
我不知道为什么会这样,所以我决定问你们,伙计:)
First, I have a form that loads values of the entry I want to edit. Everything seems to be working fine at this point. The values are "loaded" into the inputs correctly.
首先,我有一个表单,用于加载我要编辑的条目的值。在这一点上,一切似乎都很好。值正确地“加载”到输入中。
echo '<form action="edit.php?action=edit_proceed&id='.$id.'" method="post">
Názov: <input type="text" name="nazov1" class="edit" value="'.$data[nazov1].'"><br>
Druhý názov: <input type="text" name="nazov2" class="edit" value="'.$data[nazov2].'"><br>
Poznámka: <input type="text" name="poznamka" class="edit" value="'.$data[poznamka].'"><br>
Kontajner: <input type="text" name="kontajner" class="edit" value="'.$data[kontajner].'"><br>
Velkosť: <input type="text" name="velkost" class="edit" value="'.$data[velkost].'"><br>
Cena: <input type="text" name="cena" class="edit" value="'.$data[cena].'"><br>
Cena s dopravou: <input type="cena2" name="nazov1" class="edit" value="'.$data[cena2].'"><br>
Obrázok: <input type="text" name="obrazok" class="edit" value="'.$data[obrazok].'"><br>
Nezobrazovať: <input type="text" name="not_show" class="edit" value="'.$data[not_show].'"><br>
<input type="submit" value="Upraviť"></form>';
Then, I load variables from $_POST for easier future use: $nazov1 = $_POST["nazov1"]
, and so on. I quadruple-checked the variable names - they are enterred correctly.
然后,我从$ _POST加载变量以便以后使用:$ nazov1 = $ _POST [“nazov1”],依此类推。我对变量名称进行了四重检查 - 它们输入正确。
The last step of the process is the query:
该过程的最后一步是查询:
$query = 'UPDATE rastliny2 SET nazov1="'.$nazov1.'", nazov2="'.$nazov2.'",
poznamka="'.$poznamka.'", kontajner="'.$kontajner.'", velkost="'.$velkost.'",
cena="'.$cena.'", cena2="'.$cena2.'", obrazok="'.$obrazok.'", not_show="'.$not_show.'"
WHERE id="'.$id.'" ';
However, the value of nazov1 is edited to the value of cena2 and cena2 is 0. I have no clue, what could be wrong with it.
但是,nazov1的值被编辑为cena2的值,cena2的值为0.我不知道,它可能有什么问题。
2 个解决方案
#1
0
Correct this first
先纠正这个问题
Cena s dopravou: <input type="cena2" name="nazov1" class="edit" value="'.$data[cena2].'"><br>
it should be
它应该是
Cena s dopravou: <input type="text" name="nazov1" class="edit" value="'.$data[cena2].'"><br>
Look at your type type="cena2"
看看你的类型类型=“cena2”
#2
0
In your form code you have a mistake:
在您的表单代码中,您有一个错误:
<input type="cena2" name="nazov1" class="edit" value="' ....
This should be type="text"
and name="cena2"
, I assume.
我假设这应该是type =“text”和name =“cena2”。
#1
0
Correct this first
先纠正这个问题
Cena s dopravou: <input type="cena2" name="nazov1" class="edit" value="'.$data[cena2].'"><br>
it should be
它应该是
Cena s dopravou: <input type="text" name="nazov1" class="edit" value="'.$data[cena2].'"><br>
Look at your type type="cena2"
看看你的类型类型=“cena2”
#2
0
In your form code you have a mistake:
在您的表单代码中,您有一个错误:
<input type="cena2" name="nazov1" class="edit" value="' ....
This should be type="text"
and name="cena2"
, I assume.
我假设这应该是type =“text”和name =“cena2”。