SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry input tag value=0 with js alert !

    hi ..

    what should i do ?
    PHP Code:
    <form method="post" action="a.php?op=now">
    <input type=text name="lala">
    <input type=submit>
    </form>
    <?
    if($op=="now"){
        if(
    $lala !="nono"){
             echo 
    "<script>alert(\"not lala\");</script>";
         }
         
    }
    ?>
    now if i type into the input another thing (not nono) , the input value will be nothing ,empty, how can i do this and keep the entered value ?

  2. #2
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I don't follow.

    now if i type into the input another thing (not nono) , the input value will be nothing ,empty, how can i do this and keep the entered value ?
    When do you want the error message? Only if the input =nono or always or what?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  3. #3
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it`s not about the error ..

    when i write something like 'MAX' in the input, then i`ll get the js alert, it ok until now, but after i press Ok on the js alert, the value of the input will disappear !

    i wanna keep the entered text in the input after i press ok on the js alert ..

  4. #4
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    to up ^^^^

  5. #5
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Crap I didn't even see what you were getting at until now.

    PHP Code:
    <form method="post" action="a.php?op=now">
    <input type=text name="lala" value="<?= (isset($_POST["lala"]))?$_POST[\"lala\"]:\"\"; ?>">
    <
    input type=submit>
    </
    form>
    <?
    if(
    $op=="now"){
        if(
    $lala !="nono"){
             echo 
    "<script>alert(\"not lala\");</script>";
         }
         
    }
    ?>
    That should do what you want.
    Last edited by Maelstrom; Mar 29, 2002 at 22:14.
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  6. #6
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx

  7. #7
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i tryed ...
    ERROR ..
    Parse error: parse error ..

  8. #8
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Richi
    i tryed ...
    ERROR ..
    Parse error: parse error ..
    oops typo...

    PHP Code:
    <input type=text name="lala" value="<?= (isset($_POST["lala"]))?[b]$_POST[\"lala\"][/b]:\"\"; ?>">


    [edit] ok for some reason the code isn't quite showing right. ummmm this section (now bolded)

    is where the error is. it should be
    $post["lala"]

    But put slashes in front of each of the quotations.
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.


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
  •