And you check it in php with $_POST['combo'] or $_GET['combo'] according to the method used for the form. The text1, text2, ..., textn are only visible to the browser; you will not have access to them in the script the form is submitted to -- often they are the same as the v1, v2, ..., vn but that is not mandatory. -- I have a spam filter working. To mail me include "urkxvq" (with or without the quotes) in the subject line, or your mail will be ruthlessly discarded. [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <5he4nvca5f74c03l7hqg3uss7fd4skrd8j@4ax.com> [ref] => <3b62f09e.0309231240.1ca9f4b1@posting.google.com> <3b62f09e.0309241619.22dd1a8@posting.google.com> [htmlstate] => on_nl2br [postusername] => Pedro [ip] => hexkid@hotpop.c [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 5 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> > > > >And you check it in php with $_POST['combo'] or $_GET['combo'] >according to the method used for the form. > >The text1, text2, ..., textn are only visible to the browser; you will >not have access to them in the script the form is submitted to -- >often they are the same as the v1, v2, ..., vn but that is not >mandatory.[/quote] But if you leave out the value="", text1, text2 etc become the values. -- Geoff Berrow It's only Usenet, no one dies. My opinions, not the committee's, mine. Simple RFDs [url]http://www.ckdog.co.uk/rfdmaker/[/url] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => <3b62f09e.0309231240.1ca9f4b1@posting.google.com> <3b62f09e.0309241619.22dd1a8@posting.google.com> <5he4nvca5f74c03l7hqg3uss7fd4skrd8j@4ax.com> [htmlstate] => on_nl2br [postusername] => Geoff Berrow [ip] => bl@ckdog.co.uk. [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 6 [islastshown] => 1 [isfirstshown] => [attachments] => [allattachments] => ) --> PHP beginner question - PHP Development

PHP beginner question - PHP Development

Hello, I am currently learning PHP, and I have a problem with some variables. On the first page (choix.php), there is a form that lists product categories.This is the concerned part: echo "<form action='dc.php' method='post'> <select name='p_type2' value='p_type2'> \n"; while ($ligne = mysql_fetch_array($result)) { extract($ligne); echo "<option value='$p_type2'>$p_type\n"; } echo "</select>\n"; echo "<input type='submit'". "value=\"Choisissez un type de produit\"></form>\n";?> On the other page, dc.php , the program has to list the products in the category chosen by the user above. I want the product chosen to be inserted in $typeproduit = "$HTTP_POST_VARS[$p_type2]"; where $type_produit is the product chosen. (When i ...

  1. #1

    Default PHP beginner question

    Hello,

    I am currently learning PHP, and I have a problem with some variables.
    On the first page (choix.php), there is a form that lists product
    categories.This is the concerned part:

    echo "<form action='dc.php' method='post'>
    <select name='p_type2' value='p_type2'> \n";

    while ($ligne = mysql_fetch_array($result))
    { extract($ligne);
    echo "<option value='$p_type2'>$p_type\n";
    }
    echo "</select>\n";

    echo "<input type='submit'".
    "value=\"Choisissez un type de produit\"></form>\n";?>

    On the other page, dc.php , the program has to list the products in
    the category chosen by the user above. I want the product chosen to be
    inserted in

    $typeproduit = "$HTTP_POST_VARS[$p_type2]";

    where $type_produit is the product chosen. (When i write, for
    example,:

    $type_produit = "CPU";

    the program works. But it doesn't work when I put a variable. Can you
    help me ?

    Thank you


    Ben C.
    Ben Guest

  2. #2

    Default Re: PHP beginner question

    Ben wrote:

    [snip]
    > $typeproduit = "$HTTP_POST_VARS[$p_type2]";
    Try:
    $typeproduit = $HTTP_POST_VARS[$p_type2];

    --
    MeerKat

    MeerKat Guest

  3. #3

    Default Re: PHP beginner question

    On 23 Sep 2003 13:40:14 -0700, [email]microbenhotmail.com[/email] (Ben) wrote:
    > <select name='p_type2' value='p_type2'> \n";
    The select element does not have a value attribute.
    >while ($ligne = mysql_fetch_array($result))
    >{ extract($ligne);
    > echo "<option value='$p_type2'>$p_type\n";
    >}
    >echo "</select>\n";
    >
    >echo "<input type='submit'".
    > "value=\"Choisissez un type de produit\"></form>\n";?>
    >
    >On the other page, dc.php , the program has to list the products in
    >the category chosen by the user above. I want the product chosen to be
    >inserted in
    >
    >$typeproduit = "$HTTP_POST_VARS[$p_type2]";
    $typeproduit = $_POST['p_type2'];

    --
    Andy Hassall (andyandyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
    Space: disk usage ysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
    Andy Hassall Guest

  4. #4

    Default Re: PHP beginner question

    Andy Hassall <andyandyh.co.uk> wrote in message news:<vdl1nv4jloiksmv6con6bjoan7qgdn2q8e4ax.com>. ..
    > On 23 Sep 2003 13:40:14 -0700, [email]microbenhotmail.com[/email] (Ben) wrote:
    >
    > > <select name='p_type2' value='p_type2'> \n";
    >
    > The select element does not have a value attribute.
    You mean I should remove the value='p_type2'> /n"; ?
    or should I put another value ?

    Thank you for your answers guys.
    Ben Guest

  5. #5

    Default Re: PHP beginner question

    Ben wrote:
    >Andy Hassall <andyandyh.co.uk> wrote in message news:<vdl1nv4jloiksmv6con6bjoan7qgdn2q8e4ax.com>. ..
    >> On 23 Sep 2003 13:40:14 -0700, [email]microbenhotmail.com[/email] (Ben) wrote:
    >>
    >> > <select name='p_type2' value='p_type2'> \n";
    >>
    >> The select element does not have a value attribute.
    >
    >You mean I should remove the value='p_type2'> /n"; ?
    >or should I put another value ?
    You should remove the value attribute from the select

    AFAIK the select construct is like this:

    <select name="combo">
    <option value="v1">text1</option>
    <option value="v2">text2</option>
    <!-- ... -->
    <option value="vn">textn</option>
    </select>

    And you check it in php with $_POST['combo'] or $_GET['combo']
    according to the method used for the form.

    The text1, text2, ..., textn are only visible to the browser; you will
    not have access to them in the script the form is submitted to --
    often they are the same as the v1, v2, ..., vn but that is not
    mandatory.


    --
    I have a spam filter working.
    To mail me include "urkxvq" (with or without the quotes)
    in the subject line, or your mail will be ruthlessly discarded.
    Pedro Guest

  6. #6

    Default Re: PHP beginner question

    I noticed that Message-ID: <5he4nvca5f74c03l7hqg3uss7fd4skrd8j4ax.com>
    from Pedro contained the following:
    ><select name="combo">
    > <option value="v1">text1</option>
    > <option value="v2">text2</option>
    > <!-- ... -->
    > <option value="vn">textn</option>
    ></select>
    >
    >And you check it in php with $_POST['combo'] or $_GET['combo']
    >according to the method used for the form.
    >
    >The text1, text2, ..., textn are only visible to the browser; you will
    >not have access to them in the script the form is submitted to --
    >often they are the same as the v1, v2, ..., vn but that is not
    >mandatory.
    But if you leave out the value="", text1, text2 etc become the values.
    --
    Geoff Berrow
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs [url]http://www.ckdog.co.uk/rfdmaker/[/url]
    Geoff Berrow Guest

Similar Threads

  1. Beginner question
    By Chris in forum ASP
    Replies: 2
    Last Post: March 10th, 03:36 AM
  2. FMS Beginner Question
    By albertalaan in forum Macromedia Flash Flashcom
    Replies: 2
    Last Post: February 27th, 07:24 PM
  3. Simple Question From Beginner
    By big_dog_eastern in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: January 3rd, 06:24 PM
  4. Beginner's Camera Question
    By David L in forum Photography
    Replies: 11
    Last Post: August 19th, 06:42 AM
  5. beginner for a small question
    By parsl in forum Macromedia Flash
    Replies: 1
    Last Post: August 1st, 08:59 AM

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
  •