Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,596
    Thanks
    80
    Thanked 4,631 Times in 4,594 Posts
    Quote Originally Posted by Iggy0828 View Post
    changing it to showing only one record made no difference.
    Ummm...of course it doesn't work.

    You are doing this:
    Code:
     $id = $_POST['id'];
    But NO PLACE in your <form> do you have any form field that has a NAME of "id"!!!

    Easiest way to fix it:
    Code:
    <input type="hidden" name="id" value="<?php echo $row['id']; ?>" />
    Remember: Only NAMED fields are sent from the browser to the server. The id of a field doesn't matter for form submittal purposes.
    Last edited by Old Pedant; 09-26-2012 at 04:17 AM.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  2. #17
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,596
    Thanks
    80
    Thanked 4,631 Times in 4,594 Posts
    Another way to fix it:

    Replace this first <td>:
    Code:
    <td><? echo $row['id']; ?></td>
    With this:
    Code:
    <td><input name="id" style="border: none;" readonly="readonly" value="<? echo $row['id']; ?>" /></td>
    The style there, by removing the border, makes it appear that the <input> isn't really an <input>, and the readonly means nobody can change its value.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  3. Users who have thanked Old Pedant for this post:

    Iggy0828 (09-26-2012)

  4. #18
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Quote Originally Posted by Old Pedant
    and the readonly means nobody can change its value.
    I'd like to change it like "No novice can change its value". It's very easy for someone to change the values in the page displayed in the browser using tools like firebug
    If it's a page accessible to more than one user of your site, you have to make sure that the user who submits the form has the right permission to update the records referred by that id.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  5. #19
    New Coder
    Join Date
    Sep 2012
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts
    The issue is now resolved. Thanks to another forum I found out that you cannot pass values from HTML to PHP without other PHP programmers wanting to tar and feather you. Once I put everything into php it worked fine. Thanks for all the help! Which is basically what you just said Old Pedant. Thanks for your help!

  6. #20
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,596
    Thanks
    80
    Thanked 4,631 Times in 4,594 Posts
    you cannot pass values from HTML to PHP without other PHP programmers wanting to tar and feather you.
    Which of course is utter nonsense. So those so-called programmers don't really understand what they are doing.

    The HTML that submits the <form> can be written in plain HTML, in PHP, in ASP, in JSP, or in any other way. The browser has no idea where the HTML came from, so it will render it the same and process the <form> the same, no matter the source. And so long as the action= of the <form> points to a PHP page, then PHP can process it, no matter the source.

    The only oddity in PHP (not found in any other server-side system) is that if you have multiple fields with the same name then the name must end in [] to indicate a possible array of values to PHP. Big deal. I can code that in Notepad and HTML just as easily as I could code it in PHP.

    Maybe you shouldn't pay too much attention to those other forums.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •