954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

datagrid working but php_self problem

Hi, thanks to Petr.pavel I managed to get my array to have checkboxes but my problem is that the form uses php_self and so where do i use the insert query to insert to DB. I dont want page refreshes.

I usually put the insert query in a php file and point the form action to that. I also have to add a username + password + comp_id field to the form or could i add these to the first form. here is the code below that i have so far, the form echos after a round ($q) is picked from a drop down list.

/////////////////////

Select a Round:
01234
////////////////////

<?php
$q=$_GET["q"];

$con = mysql_connect('localhost', 'user', 'pass');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("realt905_realtipper", $con);

$sql="SELECT * FROM fixtures WHERE round = '".$q."'";

$result = mysql_query($sql);
echo "Game
Home
Away
";

while($row = mysql_fetch_array($result))
{
echo '';
echo '';
echo "" . $row['game'] . "";
echo '' . $row['home'] . '';
echo '' . $row['away'] . '';
echo '';
echo '';
}
echo "";
echo '';
mysql_close($con);
?>

anasta
Newbie Poster
6 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 
echo '';


This is wrong. Use this instead. echo '<form action='.$_SERVER['PHP_SELF'].' method="POST">';

nav33n
Purple hazed!
Moderator
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You