Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8786503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:38:40+00:00 2026-06-13T21:38:40+00:00

So, I have a page with a bunch of workorders on it. Each workorder

  • 0

So, I have a page with a bunch of workorders on it. Each workorder is a row in a single table, and gets put on the page with a while() statement.
I’m trying to update each row with a simple form that I put inside the while(), and an UPDATE/WHERE statement to actually add the information to the table.

Instead of adding it to the specific row, it adds it to Every row. The only thing I can think of is that my WHERE condition is wrong, but I can’t seem to figure it out. Maybe it just needs fresh eyes, or maybe I’m heading in Completely the wrong direction.

Also, any specific instructions on security, a better way to do it, etc. would be very helpful. I’m learning PHP on the fly and could use a helping hand. 🙂

<?php

        $query = "SELECT * FROM client_information"; 

        $result = mysql_query($query) or die(mysql_error());


        while($row = mysql_fetch_array($result)){ 

        $which_ad = $row['ID'];?>

            <b>Name:</b> <? echo $row['billing_name']; ?> <br>
            <b>Job Type:</b> <? echo $row['job_type']; ?> <br>
            <b>Size:</b> <? echo $row['size']; ?> <br>
            <b>Text:</b> <? echo $row['text']; ?> <br>
            <b>Notes:</b> <? echo $notes; ?> <br>

            <br><br>

        <form action="small_update.php" method="POST">
        <strong>Email Message:</strong><br>
        <textarea rows="8" cols="60" name="email_message"></textarea>        
        <input type="submit" name="submit" value="Submit"></form>


<?
$email_message = htmlspecialchars ("{$_POST['email_message']}", ENT_QUOTES);


if (mysql_errno() != 0) {
die(mysql_error());
}

mysql_query(
"UPDATE client_information
SET email_message='$email_message'

WHERE ID='$which_ad'"
);


if (mysql_errno() != 0) {
die(mysql_error());
}

    }

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:38:41+00:00Added an answer on June 13, 2026 at 9:38 pm

    You don’t specify the id in your form:

    <form action="small_update.php" method="POST">
        <strong>Email Message:</strong><br>
        <textarea rows="8" cols="60" name="email_message"></textarea>
        <input type="hidden" name="id" value="<?php echo $which_ad; ?>">  
        <input type="submit" name="submit" value="Submit">
    </form>
    

    you need to also make sure you know what id was submitted:

    "UPDATE client_information
    SET email_message='$email_message'
    
    WHERE ID='$_POST['id']'"
    

    Of course, you’re wide open to attacks like this as everyone else is saying. You need to look into mysqli or pdo to sanitize your input…

    Ans also upon inspection you’re evaluating your post data in the loop. Don’t do that. Just do your evaluation before everything else is processed on the page…

    <?php
    if($_POST)
    {
        //run processing here
    }
    
    // do your fetch code here and display the forms...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to have a page with a bunch of buttons, each of which
I have a page that has a bunch of widgets on it. Each widget
i have a page that loads a bunch of different windows which each come
I currently have a page with a bunch of lists, where each list has
I have a page that loads a bunch of scripts to prepopulate dropdowns and
I have a page where I am loading bunch of images initially when the
I have a page that has a bunch of user controls on it. I
I have a web page with a bunch of links. I want to write
I have a page with one main query with a bunch of filters on
I have a page that will basically be used to concatenate a bunch of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.