Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

Mysql query after submiting POST form

Aloittaja paziowiec, heinäkuu 07, 2008, 05:27:46 IP

« edellinen - seuraava »

paziowiec

hai :)

I came to a problem I cannot solve, I have virtually no idea where I could have made an error.

Problem outline:
I have a site called index.php.
I have a script on site index.php?ID=members (in index.php there is a 'case' where I can change the main table content by includes).
The script:
$query = "SELECT memberName,main,1sub,2sub,3sub,mainlvl,1sublvl,2sublvl,3sublvl,sets,weapons,jools FROM xforamz_members WHERE ID_MEMBER=$urzytkownicy";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
echo '<form name="Zmien" action=\'index.php?ID=updated\' method="post">';
echo '<table style="margin-left: 10px">';
echo '<tr><td align="left"><font color="yellow"><br />Nick:</font></td></tr>';
echo '</table><table style="margin-left: 20px">';
echo '<tr><td align="left"><font color="limegreen">>: </font>'.$row['memberName'].'</td></tr>';
echo '</table><table style="margin-left: 10px">';
echo '<tr><td align="left"><font color="yellow">Classes:</font></td></tr>';
echo '</table><table style="margin-left: 20px">';
echo '<tr><td align="left"><font color="limegreen">[main] >: </font><input type="text" name="mainlvl" value="'.$row['mainlvl'].'" size="2"> <input type="text" name="main" value="'.$row['main'].'" size="20"></td></tr>';
echo '<tr><td align="left"><font color="limegreen">[sub1] >: </font><input type="text" name="1sublvl" value="'.$row['1sublvl'].'" size="2"> <input type="text" name="1sub" value="'.$row['1sub'].'" size="20"></td></tr>';
echo '<tr><td align="left"><font color="limegreen">[sub2] >: </font><input type="text" name="2sublvl" value="'.$row['2sublvl'].'" size="2"> <input type="text" name="2sub" value="'.$row['2sub'].'" size="20"></td></tr>';
echo '<tr><td align="left"><font color="limegreen">[sub3] >: </font><input type="text" name="3sublvl" value="'.$row['3sublvl'].'" size="2"> <input type="text" name="3sub" value="'.$row['3sub'].'" size="20"></td></tr>';
echo '</table><table style="margin-left: 10px">';
echo '<tr><td align="left"><font color="yellow">Gear:</font></td></tr>';
echo '</table><table style="margin-left: 20px">';
echo '<tr><td align="right"><font color="limegreen">[armor sets] >: </font></td><td><input type="text" name="sets" value="'.$row['sets'].'" size="30"></td></tr>';
echo '<tr><td align="right"><font color="limegreen">[weapons] >: </font></td><td><input type="text" name="weapons" value="'.$row['weapons'].'" size="30"></td></tr>';
echo '<tr><td align="right"><font color="limegreen">[jewelry] >: </font></td><td><input type="text" name="jools" value="'.$row['jools'].'" size="30"></td></tr>';
echo '</table><table style="margin-left: 30px">';
echo '<tr><td><input type="submit" name="Update" value="Submit informations"></td></tr>';
echo '</table>';
echo '</form>';

Basically it's a form with prefilled values and looks like this:


As you might have noticed, when I hit a buton 'Submit informations' i get redirected to index.php?ID=updated
This site is nothing more than a script that will run after submitting form, this is it's content:
<?php
require("forum/SSI.php");
mysql_select_db('kezzlock?jezjez');

if(isset(
$Update))
{
mysql_query("INSERT INTO xforamz_members (mainlvl, main, 1sublvl, 1sub, 2sublvl, 2sub, 3sublvl, 3sub, sets, weapons, jools) VALUES ('$_POST[mainlvl]', '$_POST[main]', '$_POST[1sublvl]', '$_POST[1sub]', '$_POST[2sublvl]', '$_POST[2sub]', '$_POST[3sublvl]', '$_POST[3sub]', '$_POST[sets]', '$_POST[weapons]', '$_POST[jools]' ) WHERE ID_MEMBER=$lawl") or die(mysql_error());
}
?>


And now, when I submit the form page index.php?ID=updated doesnt load... but when I remove the mysql_query from that script and put for example echo "hello world"; then it loads and 'hello world' fine.

I know this is some ugly looking code but would anyone be that kind to help me figure where i have made mistake?:)

paziowiec


Advertisement: