1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

button help

Discussion in 'PHP' started by izlik, Jul 21, 2008.

  1. #1
    Hello

    i need some help finishing The button & form code bellow. It's supposed to be so if you write for example "chicken" in the bot and press "search" it goes to http://mypage.com/file.php?=what was writen in the box

    Can someone please help me make it work?

    <input size="15" type="text" name="tag" value="Search for tags"  id='tagurl' onclick="highlight('tagurl');" /><input type="submit" value="search" />
    PHP:
     
    izlik, Jul 21, 2008 IP
  2. BMR777

    BMR777 Well-Known Member

    Messages:
    145
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    140
    #2
    For the search form:

    <form action="file.php" method="get" name="form" id="form"><input size="15" type="text" name="tag" value="" id='tagurl'/><input type="submit" value="search" /></form>
    HTML:
    For file.php:

    <?php
    $tagurl = $_GET["tagurl"];
    
    if($tagurl != ""){
    //If the submitted value is not blank, do something
    }
    else {
    //If it is blank, do something else
    }
    
    ?>
    PHP:
    Basically, in file.php edit...

    if($tagurl != ""){
    //If the submitted value is not blank, do something
    }
    PHP:
    ... to do something if the input is not empty. What I recommend is you check the database and if there are records with your search string then show them, otherwise if there are no records, do nothing.

    Let me know if this helped. (+rep would also be nice)

    This is just a rough bit of code, let me know if you need more help.

    BMR777
     
    BMR777, Jul 21, 2008 IP
    izlik likes this.
  3. izlik

    izlik Well-Known Member

    Messages:
    2,399
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    185
    #3
    thanks alot, +rep will be added and i will send yo a PM! :)
     
    izlik, Jul 21, 2008 IP