Jump to content

Form Submiting


Verbat

Recommended Posts

echo "<br><br>
<form method=post action=edit_distance_go.php>
<table align='center' cellpadding='0' cellspacing='1' width='95%' class='tbl-border'>
<tr><td colspan='6' class=tbl2><div align=left><img src=./images/planes/tlogo.png></td></tr>
<tr>
<td class=tbl2 width='20%'><b><font size=1 color=#3A3935>Start</b></font></td>
<td class=tbl2 width='20%'><b><font size=1 color=#3A3935>End</b></font></td>
<td class=tbl2 width='20%'><b><font size=1 color=#3A3935>Distance</b></font></td>
<td class=tbl2 width='20%'><b><font size=1 color=#3A3935>Start City</b></font></td>
<td class=tbl2 width='20%'><b><font size=1 color=#3A3935>End City</b></font></td>
</tr>
";


$query12 = sprintf("SELECT * from distance WHERE distance='0' LIMIT 10",$db_connect); 
$result12 = dbquery($query12);
while ($roqww = mysql_fetch_assoc($result12) ) {
$start = $roqww['start'];
$end = $roqww['end'];
$distance = $roqww['distance'];
$scity = $roqww['scity'];
$ecity = $roqww['ecity'];
$idd = $roqww['id'];







echo "
<tr>
<td class=tbl2 width='20%'><b><font size=1 color=#3A3935>$start</b></font></td>
<td class=tbl2 width='20%'><b><font size=1 color=#3A3935>$end</b></font></td>
<td class=tbl2 width='20%'><b><font size=1 color=#3A3935><input type='text' name='distance' 

size='15' class='textbox' maxlength=15></b></font></td>
<td class=tbl2 width='20%'><b><font size=1 color=#3A3935>$scity</b></font></td>
<td class=tbl2 width='20%'><b><font size=1 color=#3A3935>$ecity</b></font></td>
</tr>
";


}
echo "
<tr>
<td class=tbl1 colspan='5'><br></td>

</tr>


<tr><td colspan='5' align=center class=tbl2><input type=submit value='Edit' class='button' 

align=center></td></tr> 
</table><br><br>";

 

 

Now i want the input of distance to change all the 10 rows at the same time by clicking 1 button.

Link to comment
Share on other sites

What i mean is, for example when you edit a table in the SQL DB you can pick several rows to edit and then click OK and it will save everything at once.

 

I want to do the same with the PHP code.

 

Google. I doubt anyone here is going to just make your code for you.

 

http://www.roscripts.com/PHP_MySQL_by_examples-193.html

Link to comment
Share on other sites

Of course not make the script for me but just explain alittle.

 

To display the rows would be something like:

$query = "SELECT * FROM table WHERE row = $row";  //or whatever SQL you want to use
$result = @mysql_query($query,$db_connection) or die();

if (mysql_num_rows($result) < 1 ) {
// no records found for query
} else {
while( $row = mysql_fetch_array($result) )
{
//put output code here
// you could do INPUT codes here for a form using $row['distance'] (or whatever part you want to select) as an array
}
}

 

 

Then to update it would be something like:

 

for($i=0; $i<$count; $i++) {
$query1="UPDATE table SET distance ='$row[$i]' WHERE whatever = '$whatever[$i]' ";
$result1 = @mysql_query($query1, $db_connection);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.