page.php?terms action

Discussion in 'PHP' started by promotingspace.net, Aug 10, 2007.

  1. #1
    Hi
    I'm trying to code a paid search. first i coded a test page that collects the search term and publisher id this way:
    
    <?php 
    	require_once 'global.php';
    $searchid="12";
    $publisher="13";
    $textlong ="80";
    $label="websearch";
    ?>
    <form method="GET" action="<?php echo "search.php?searchid=$searchid&publisher=$publisher"; ?>">
    <input type="text" name="q" size="<?php echo $textlong; ?>">
    <input type="submit" value="<?php echo $label; ?>">
    </form>
    PHP:
    and search.php is coded this way:
    
    <?php
    	require_once 'global.php';
    $searchid=clean($_GET['searchid']);
    $publisher=clean($_GET['publisher']);
    $q=clean($_GET['q']);
    
    // then I search the database for $q and display the result
    ?>
    PHP:
    as you see, i was trying to send the publisher details to search.php in order to increase their balance etc. but what i am getting in the result is not sending that info to search.php
    Although when I view the source code of test.php ( in the browser ) it is:
    
    <form method="GET" action="search.php?searchid=12&publisher=13">
    <input type="text" name="q" size="80">
    <input type="submit" value="websearch">
    </form>
    Code (markup):
    But when I enter a keyword ( assume it hosting ) the action page is:
    http://127.0.0.1/adcenter/search.php?q=hosting
    plus sending notices:
    Notice: Undefined index: searchid in g:\programs new\easyphp\www\adcenter\search.php on line 3
    Notice: Undefined index: publisher in g:\programs new\easyphp\www\adcenter\search.php on line 4
    why the action page (search.php) is missing the searchid and publisherid?
    thanks
     
    promotingspace.net, Aug 10, 2007 IP
  2. Providence

    Providence Peon

    Messages:
    568
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try using

    <?php 
        require_once 'global.php';
    $searchid="12";
    $publisher="13";
    $textlong ="80";
    $label="websearch";
    ?>
    <form method="GET" action=search.php?searchid=<?php echo $searchid ?>&publisher=<?php echo $publisher; ?>">
    <input type="text" name="q" size="<?php echo $textlong; ?>">
    <input type="submit" value="<?php echo $label; ?>">
    </form>
    Code (markup):
    If that doesn't work,

    try using POST.
     
    Providence, Aug 10, 2007 IP
  3. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #3
    Soemthing else you could do.

    
    <?php     
    require_once 'global.php';
    $searchid="12";
    $publisher="13";
    $textlong ="80";
    $label="websearch";
    ?>
    <form method="GET" action="search.php">
    <input type="text" name="q" size="<?php echo $textlong; ?>">
    <input type="hidden" name="searchid" value="<?php echo $searchid; ?>">
    <input type="hidden" name="publisher" value="<?php echo $publisher; ?>">
    <input type="submit" value="<?php echo $label; ?>">
    </form>
    
    PHP:
     
    exodus, Aug 10, 2007 IP