Ask a Question related to PHP Development, Design and Development.
-
Ben #1
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
-
Beginner question
new to the world of asp! I'm trying to define session variables using the following code: Session("Employee")= when i replace the Session... -
FMS Beginner Question
I'm a total newbie here so I appreciate any help. We just installed FMS and would like to use it for streaming videos. I've researched and found... -
Simple Question From Beginner
I have created an swf movie, which I embedded to my site. I want my movie to play only once , just when the mouse cursor hovers over this movie... -
beginner for a small question
Hello, The pictures of my animation is beautiful in flash mx and when i test animation the pictures are not very nice - lost quality... how to... -
A Beginner question -where to start?
On Sat, 28 Jun 2003 09:19:52 +0100, redjupiter wrote: System descriptions can be found here: http://sunsolve.sun.com/handbook_pub/Systems/ -
MeerKat #2
Re: PHP beginner question
Ben wrote:
[snip]Try:> $typeproduit = "$HTTP_POST_VARS[$p_type2]";
$typeproduit = $HTTP_POST_VARS[$p_type2];
--
MeerKat
MeerKat Guest
-
Andy Hassall #3
Re: PHP beginner question
On 23 Sep 2003 13:40:14 -0700, [email]microben@hotmail.com[/email] (Ben) wrote:
The select element does not have a value attribute.> <select name='p_type2' value='p_type2'> \n";
$typeproduit = $_POST['p_type2'];>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]";
--
Andy Hassall (andy@andyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
Space: disk usage analysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
Andy Hassall Guest
-
Ben #4
Re: PHP beginner question
Andy Hassall <andy@andyh.co.uk> wrote in message news:<vdl1nv4jloiksmv6con6bjoan7qgdn2q8e@4ax.com>. ..
You mean I should remove the value='p_type2'> /n"; ?> On 23 Sep 2003 13:40:14 -0700, [email]microben@hotmail.com[/email] (Ben) wrote:
>>> > <select name='p_type2' value='p_type2'> \n";
> The select element does not have a value attribute.
or should I put another value ?
Thank you for your answers guys.
Ben Guest
-
Pedro #5
Re: PHP beginner question
Ben wrote:
You should remove the value attribute from the select>Andy Hassall <andy@andyh.co.uk> wrote in message news:<vdl1nv4jloiksmv6con6bjoan7qgdn2q8e@4ax.com>. ..>>> On 23 Sep 2003 13:40:14 -0700, [email]microben@hotmail.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 ?
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
-
Geoff Berrow #6
Re: PHP beginner question
I noticed that Message-ID: <5he4nvca5f74c03l7hqg3uss7fd4skrd8j@4ax.com>
from Pedro contained the following:
But if you leave out the value="", text1, text2 etc become the values.><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.
--
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



Reply With Quote

