Update FORM only if field is empty

Discussion in 'PHP' started by tomm098, Aug 26, 2009.

  1. #1
    Hey All. I have a FORM that updates records in my database. It has three fields. User, Scene and Time. I want it so users can only edit scenes that are empty. So that when someone enters a Scene, that entry is then locked out. And only the user who added it can update it.

    So basically. The Scene is initially empty. Then someone adds a Scene, there User is attached to the entry. Then Only that user can edit the scene again.

    Heres the 3 rows:

    <p>
    <input name="Time" type="text" id="Time" value="<?php echo $row_MusicBody['Time']; ?>" />
    </p>
    <p>
    <textarea name="Scene" id="Scene" cols="23" rows="3"><?php echo $row_MusicBody['Scene Description']; ?></textarea>
    <p>
    <input name="User" type="hidden" id="User" value="<?php echo $_SESSION['MM_Username']; ?>" readonly="readonly" />
    </p>
    </p>
     
    tomm098, Aug 26, 2009 IP
  2. kane4545

    kane4545 Guest

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use if statement to do it

    
    if(condtition)
    {
    
    }
    else
    {
    
    }
    
    HTML:
    keep your code in else part and if part
     
    kane4545, Aug 26, 2009 IP