Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Posts
    5

    Exclamation Unanswered: problem with a form

    Hi,

    I have a problem with a form.

    I am not a programmer, but I didn't find what I need,
    So I programmed a script about reading articles using PHP & MYSQL

    First the guest choose the cat and then the author, so the action will be :

    Show.php?action=showcat&catid=$catid&author= $authorid

    After that he can choose the page and the section :

    ==
    View page {} and section {} (do)
    ==
    How can I submit (page) and (section) var into the URL like this :

    Show.php?action=showcat&catid=$catid&author= $authorid&page=$page&section=$section


    I used (method=\"POST\") and it works but it didn't view the (page) and (section) var in the URL above:

    Show.php?action=showcat&catid=$catid&author= $authorid

    The script will print $page and $section successfully and view the article with the page and section number.

    When I used (method=\"GET\") it didn't work with me,
    I tried to test it in a simple code

    <?
    echo "page : $page<br> section : $section";
    echo "
    <form name=\"form\" method=\"GET\" action=\"show.php\">
    <font face=\"Tahoma\" size=\"5\">view page</font>
    <input type=\"text\" name=\"page\" size=\"5\">
    <font face=\" Tahoma \" size5\">and section</font>
    <input type=\"text\" name=\"section\" size=\"5\">
    <input type=\"submit\" name=\"Submit\" value=\"do\">
    </form>

    ?>

    this will delete the last URL (Show.php?action=showcat&catid=$catid&author= $authorid)
    the cat and author info is disabled.

    The Url will be :

    show.php?page=1&section=2&Submit=do

    now the (Submit=do) appears!

    Is there a way to grab the page and section var into the URL like this:
    Show.php?action=showcat&catid=$catid&author= $authorid&page=$page&section=$section

  2. #2
    Join Date
    May 2002
    Posts
    7
    hi,

    I think you need to put the parameter $page and $section in the action tag, like this:

    <?

    echo "page : $page<br> section : $section";

    echo "
    <form name=\"form\" method=\"GET\" action=\"show.php?page=$page&$section=$section\">
    <font face=\"Tahoma\" size=\"5\">view page</font>
    <input type=\"text\" name=\"page\" size=\"5\">
    <font face=\" Tahoma \" size5\">and section</font>
    <input type=\"text\" name=\"section\" size=\"5\">
    <input type=\"submit\" name=\"Submit\" value=\"do\">
    </form>
    ";

    ?>

Posting Permissions

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