Jump to content

PHP Problem


Natali25

Recommended Posts

Hi everybody,

Here is the code for creating a website,please have a look on the attachment(It shows how my web page looks like).I have 3 forms in each row and I have almost 2000 rows.

 

1)my problem is whenever I choose an option from one of the forms,It shows the result for the whole coulmns (example :If I choose passed on the first row and I click submit ,It shows passed for the all the rows in this column)

So please help me if you can give me a script that it works properly.

 

2)Also I have another problem.my problem is each form works seprately from the other.I mean I can not see the result of 3 forms together.it does not save the result from the previous column?

<html>
<head>
</head>
<body>

<font size="6">
<?php
$db_host ="localhost";
$db_username ="***";
$db_pass ="****";
$db_name ="****";

@mysql_connect("$db_host","$db_username","$db_pass") or die ("Could not connect to mySQL");
@mysql_select_db("$db_name") or die ("No database");


$sql ="SELECT * FROM `item_shop`";   //Select everything from the Database Where the columt Id = $id
$result = mysql_query($sql);
echo "<table border='1' width='100%' align='center' cellpadding='6' cellspacing='1' bgcolor='#CCCCCC' class='font_2'>"; //Begin of the Table
?>

<tr align="center" valign="middle">

    <td width="6%" bgcolor="#FFA07A" ><a href="?order=orgobjid&account_id=&send=send&keytype=GUID&keyword=&seq=desc">ID</a></td>
    <td width="12%" bgcolor="#FFA07A" >Name</td>
    
    <td width="1%" bgcolor="#FFA07A" >Stacked Number:\32</td>
    <td width="32%" bgcolor="#FFA07A" >Description</td>
    <td width="6%" bgcolor="#FFA07A" >Type </td>
    <td width="20%" bgcolor="#FFA07A" >Used Type</td>
<td width="8%" bgcolor="#FFA07A" >Verification</td>
<td width="8%" bgcolor="#FFA07A" >Item Flag</td>
<td width="40%" bgcolor="#FFA07A" >Test Comment</td>


</tr>

<?php
while($row = mysql_fetch_array($result))
{
?>
    <td width="6%" bgcolor="#FFDEAD" ><a href="?order=orgobjid&account_id=&send=send&keytype=GUID&keyword=&seq=desc"><?php echo $row['ID']; ?></a></td>
    <td width="12%" bgcolor="#FFDEAD" ><?php echo $row['Name']; ?></td>
    
    <td width="1%" bgcolor="#FFDEAD" ><?php echo $row['Stacked_Number']; ?></td>
    <td width="32%" bgcolor="#FFDEAD" ><?php echo $row['Description']; ?></td>
    <td width="6%" bgcolor="#FFDEAD" ><?php echo $row['Type']; ?> </td>
    <td width="20%" bgcolor="#FFDEAD" ><?php echo $row['Used_Type']; ?></td>


 <td align="center" bgcolor="#FFDEAD">


  
<form method="post" action="http://****.php"">
Test Result?
<select name="Choose One">
<option>Choose One</option>
<option>Passed</option>
<option>Blocked</option>
<option>Retest</option>
<option>Failed</option>
</select><br>
<input type="submit" value="Submit">
<td align="center" bgcolor="#FFDEAD">
</form>

<form method="post" action="http://*****.php">
Item Flag?
<select name="degree">
<option>Choose One</option>
<option>Item Shop</option>
<option>Phirius Tocken Shop </option>
<option>Both</option>
</select>
<br><input type="submit" value="Submit">
</form>


<td align="center" bgcolor="#FFDEAD">
<form method="post" action="http://****.php">
<textarea rows="5" cols="20" wrap="physical" name="comments">
<?php echo $row['Test_Comment']; ?>
</textarea><br>

<input type="submit" value="Submit">
<input type="reset" value="Reset">

</form>


<td align="center" bgcolor="#FFDEAD">
   <table border="1">
      <tr><td>
      <form name="Form1" method="POST" action="http://***.php">
          
         <br/>
          <textarea name="txtMessage" cols="30" rows="4"></textarea>
           <br />
           <input type="submit" name="Submit" value="Submit" />
            <input type="reset" name="Submit2" value="Reset" />
         </p>
        </form>
       </td></tr>
       </table>
   
   
   <pre>
   
   <? echo $_POST['txtMessage']; ?>
   </pre>
   </p>

<?php
echo "</tr>";
}
echo "</table>"; //End of the Table  
?>
</body>
</html>

post-134354-13482403556669_thumb.jpg

post-134354-13482403557434_thumb.jpg

post-134354-13482403558023_thumb.jpg

Link to comment
Share on other sites

You have 1,000 select boxes named "Choose one"

 

The NAME of an item in a form determines the name of the variable eventually posted to your PHP page.  If the name is "selectOne" (never use spaces in form element names), then $_POST['selectOne'] will be your variable.  You have nothing in here that tells your form WHICH item you're selecting.  All you're passing back is the word "passed" inside "selectOne."  You need a hidden form element in all of these forms which contains the itemID you want to modify.  Then limit your update query to only that item ID.

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.