Forms in PHP

Einklappen
Dieses Thema ist geschlossen.
X
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Forms in PHP

    Could somebody please give me some assistance.

    I have written a PHP script for MySQL which can be viewed at
    http://a-i-s.net/temp/mission2.php
    If you look at the source code you will see the variable $Guest is hard coded.

    How do I use a form to input the value of $Guest from a drop down list.

    Thanks.

    php-Entwicklung | ebiz-consult.de
    PHP-Webhosting für PHP Entwickler | ebiz-webhosting.de
    die PHP Marktplatz-Software | ebiz-trader.de

  • #2
    Hope that helps

    <select size="1" name="D1">

    <?while ($row= mysql_fetch_row($result))


    Echo "<option >".$row=["col"]."</option>"

    ?>


    </select>

    regards
    F2p

    php-Entwicklung | ebiz-consult.de
    PHP-Webhosting für PHP Entwickler | ebiz-webhosting.de
    die PHP Marktplatz-Software | ebiz-trader.de

    Kommentar


    • #3
      <select size="1" name="D1">

      <?while ($row= mysql_fetch_row($result))

      {
      Echo "<option >".$row=["col"]."</option>"
      }
      ?>


      </select>

      forgot the {}

      php-Entwicklung | ebiz-consult.de
      PHP-Webhosting für PHP Entwickler | ebiz-webhosting.de
      die PHP Marktplatz-Software | ebiz-trader.de

      Kommentar


      • #4
        Re ; PHP Forms

        Hi,

        Thanks for the response.

        Ok know how to setup up a form and the drop down list.

        What I actually need is how do I make the form option value work with the script.

        i.e. The value in the form must become part of the SELECT statement in the query e.g. LIKE '$option'

        php-Entwicklung | ebiz-consult.de
        PHP-Webhosting für PHP Entwickler | ebiz-webhosting.de
        die PHP Marktplatz-Software | ebiz-trader.de

        Kommentar


        • #5
          If you want a variable $Guest be set in the action script of the form, simply name an input Guest:
          <input type=text name=Guest>

          You can even do this with linear arrays (vectors):
          <input type=checkbox name="check[]" value=1>check 1
          <input type=checkbox name="check" value=2>check 2
          for ($i=0;$i<count($check);$i++) echo $i.'<br>';
          (or: echo implode('<br>',$check);
          will output the values of all checked boxes, if any was checked. if not, $check will be unset (and so may not be used as an array)

          -=* Titus *=-
          | php pro |
          |nerd for life|
          """""""""""""""

          php-Entwicklung | ebiz-consult.de
          PHP-Webhosting für PHP Entwickler | ebiz-webhosting.de
          die PHP Marktplatz-Software | ebiz-trader.de

          Kommentar


          • #6
            or for a dropdown:
            <select name=dropdown>
            <option value="1">first</option>
            <option value="2">second</option>
            <option value="3">third</option>
            </select>

            multiple choice:
            <select multiple size=3 name="multiple[]">
            <!-- remember the array part? -->
            <option value="1">first</option>
            <option value="2">second</option>
            <option value="3">third</option>
            </select>

            php-Entwicklung | ebiz-consult.de
            PHP-Webhosting für PHP Entwickler | ebiz-webhosting.de
            die PHP Marktplatz-Software | ebiz-trader.de

            Kommentar


            • #7
              Solved

              Thanks for the hints.

              My problem was I was using the variable form $Guest instead of the plain form Guest for the name.

              php-Entwicklung | ebiz-consult.de
              PHP-Webhosting für PHP Entwickler | ebiz-webhosting.de
              die PHP Marktplatz-Software | ebiz-trader.de

              Kommentar

              Lädt...
              X