SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    873
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php javascript error message

    Dear All,
    I have text input such as below. What I want is that when I press submit button if the Item Name is empty then I want the error text in red shown beside the text input. I am using php how can I achieve it? Thank you.
    PHP Code:
    <td width="90%">
                  <
    input class="text" size=5 id="itemName" name="itemName" value=""
                  <
    script>document.getElementById(itemName).focus()</script>              
    </td> 

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,401
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)
    PHP Code:
    if (!isset($_POST['itemName']) || $_POST['itemName'] == '') {
      
    // echo the error message



Bookmarks

Posting Permissions

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