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.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    64
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Question my code doesn't work

    help, i don't know why my code is not working at all, it was expected to produce a prompt once the end user did not put anything on the forms

    PHP Code:
    <script type="text/javscript">
    function 
    check_data(my_form){
      var 
    problem false;
      if(
    my_form.name.value==""){
        
    alert("Enter your name. ");
        
    my_form.name.value="*** Name";
        
    my_form.name.focus();
        
    problem true;
      }

      if(
    my_form.email.value==""){
        
    alert("Enter your email address. ");
        
    my_form.email.value="*** Email Address";
        
    my_form.email.focus();
        
    problem true;
      }

      if(
    my_form.url.value=""){
        
    alert("Enter url. ");
        
    my_form.url.value="*** URL";
        
    my_form.url.focus();
        
    problem true;
      }

      if((
    my_form.url_category.selectedIndex == 0) || (my_form.url_category.value == 0))  {
            
    alert("please select a category for this URL");
            
    problem true;
      }

      if(
    problem){
            return 
    false;
      }else{
        return 
    true;
      }
    }
    </script>

    <form name="url_form" action="handle_submit_url.php" method="post" onsubmit="return check_data(this);">
    <fieldset><legend>Enter Your information in the form below:</legend>
    <p><b>Your Name:</b><input type="text" name="name" size="40" maxlength="60" /></p>
    <p><b>Email Address:</b><input type="text" name="email" size="40" maxlength="60" /></p>
    <p><b>URL:</b><input type="text" name="url" size="40" maxlength="80"></p>
    <p><b>URL Category:</b><select name="url_category">
            <option>Choose One:</option>
            <option value="3">Code Libraries</option>
            <option value="6">General Database</option>
            <option value="5">General MySQL</option>
            <option value="1">General PHP</option>
            <option value="4">Programming</option>
            <option value="2">Web Development</option>
    </select></p>
    </fieldset>
    <div align="center"><input type="submit" name="submit" value="submit" /></div>
    </form> 
    Last edited by capt_nemo777; 05-31-2009 at 06:27 PM.

  • #2
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    It's just a typo.

    Code:
    <script type="text/javascript">

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    64
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Thanks for the help sir,... ...is there a way, we can mark this thread as "resolved"?
    Last edited by capt_nemo777; 05-31-2009 at 04:30 PM.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,310
    Thanks
    203
    Thanked 2,563 Times in 2,541 Posts
    Quote Originally Posted by capt_nemo777 View Post
    Thanks for the help sir,... ...is there a way, we can mark this thread as "resolved"?

    6) Thread prefixes usage. In some forums, you can select from a list a prefix to add to your thread's title, for example, a prefix of "resolved" once you've received a satisfactory answer to your question. To add a prefix after your thread has been initially posted, click on the "Edit" button under the first post of the thread, then the "Go Advanced" button. You have 14 days to update your thread's title.


  •  

    Posting Permissions

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