How to use a form to insert or update question..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stamyo
    New Member
    • May 2006
    • 1

    How to use a form to insert or update question..

    Hello to everyone,
    i'm facing the following problem:
    I have a form which is used for both insert or update data.. The situation is like that: when the user fills the form, press the submit button and an error (regarding the validation of data) occurs (e.g. he puts letters instead of numbers), the form sends him to a page in order to see what was wrong and a "back" button appears. Now, when he is in an 'update mode' and press 'back' the form is filled in and when he is in 'insert mode' the form is empty and this is because the following peace of code:
    [code=html]
    <form method=post
    action="<?=$edi t?"edit_book.ph p":"insert_book .php";?>">
    <table border=0>
    <tr>
    <td>ISBN:</td>
    <td><input type=text name=isbn value="<?=$edit ?$book["isbn"]:""; ?>"></td>
    </tr>[/code]

    The question is how am I gonna syntax the value so the user will be able to preserve the data while he is in 'insertion' and he returns to the form

    Thanx in advance, Stam
    Last edited by pbmods; Oct 6 '07, 08:54 PM. Reason: Added CODE tags.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Stam. Welcome to TSDN!

    Please use CODE tags when posting source code:

    &#91;CODE=ph p]
    PHP code goes here.
    &#91;/CODE]

    Comment

    • FullyH3ktik
      New Member
      • Sep 2007
      • 52

      #3
      create variables for the values in the form and then when the user gets "redirected " to the page, just call them from the variables.

      Comment

      Working...