Jump to content

Urgent!!! Need help to update a field in php!!!


Recommended Posts

Gd morning!

 

I have a table diplaying a list of data which is called from the database (based on selection made earlier).

I use "while($row=my_sql_fetch_array($result)" to call all data for that table.

 

Now, i need to update one of the data field of the table for the chosen row only.

I use text field to display the data to make it editable.

Then i create a button for each row to pass all needed data and the updated data to the following page where update takes place.

 

However, the ediited value only for that chosen row cant be grabbed and be passed to the next page.

 

How should i solve this?

 

Thanks in advance.

ALSO when you signed up you accept the Term & Conditions

 

Forum Guidelines

2. Users will not mark their post as being "URGENT" by either making the post ALL CAPS or adding any hint that they need it done Quick or ASAP. All posts are treated equal, your post is no more important than any other user's post on this forum. If it is "URGENT" pay someone to do it.

This is my table: (table.php)

 

 

<? while ($row9 = mysql_fetch_array($result9)) {  ?>

 

 

<td width="7%" bgcolor="#FFFFCC">Company</td>

<td width="18%" bgcolor="#FFFFCC">NRIC</strong></td>

<td width="44%"  bgcolor="#FFFFCC">Name</td>

<td width="11%"  bgcolor="#FFFFCC">Validity</td>

<td width="15%"  bgcolor="#FFFFCC">Update Validity</td>

 

<td><? echo "".$row12['company_code']."";?></td>

<td><? echo "".$row9['NRIC']."-".$row9['NRIC1']."-".$row9['NRIC2']."";?></td>

<td><? echo "".$row12['name']."";?></div></td>

<td><input type="text" name="validity_new" value="<?php if ($row9['validity'] != NULL){echo   

      $row9['validity'];}?>" size="1" maxlength="3"></td>

<td><div align="center"><input type="image" name="update_validity" value="<? echo 

      "".$row9['NRIC']."-".$row9['NRIC1']."-".$row9['NRIC2']."";?>" src="Pictures/4.png" alt="submit button"

      width="20" height="20"/></div></td>

 

 

 

Once the "Update Validity" button is pushed, the data is passed to "update.php".

 

$validity_new = $_POST['validity_new'];

 

In "update.php", the value of updated validity for only the selected row cant be retrieved. Only if value for validity for all the row in the table are changed to a same value, the updated value can be retrieved in the update.php.

 

 

I just want to update validity for the row selected. How can i do this? Thanks a lot.

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.