LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-15-2005, 10:50 PM   #1
benrose111488
Member
 
Registered: Jun 2004
Location: Wantage, NJ
Distribution: Fedora 7
Posts: 177

Rep: Reputation: 30
Receiving Listboxes in PHP


Okay, here's the code I have on a page in HTML:

Code:
<FORM NAME="vote" ACTION="post.php" METHOD="POST">
<select NAME="actual">
<option>Ashley Allshouse</option>
<option>Zac Hall</option>
<option>Christa Zinner</option>
<option>Kayla Hall</option>
<option>Ben Rose</option>
</select>
<INPUT TYPE="SUBMIT" VALUE="Vote!">
</FORM>
Then on page post.php:

Code:
$vote=$POST["actual"];
returns a null value and prints nothing. Any ideas?

Thanks in advance
 
Old 01-15-2005, 11:02 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
You need value attributes in your option tags as in:

Code:
<select NAME="actual">
<option value="Ashley Allshous">Ashley Allshouse</option>
...
</select>
The value attribute is what actually gets past in the post or get request.
 
Old 01-15-2005, 11:11 PM   #3
benrose111488
Member
 
Registered: Jun 2004
Location: Wantage, NJ
Distribution: Fedora 7
Posts: 177

Original Poster
Rep: Reputation: 30
hmmm, I looked into it really close, and realized my mistake was actually very stupid...

Code:
$vote=$POST["actual"];
Should have actually been:

Code:
$vote=$_POST["actual"];
This works in Mozilla now effectively, but my question now is if I'm missing the value attribute, will the same code work in Internet Explorer?

Last edited by benrose111488; 01-15-2005 at 11:33 PM.
 
Old 01-16-2005, 06:23 AM   #4
N43
LQ Newbie
 
Registered: Sep 2004
Location: Germany
Distribution: Slackware
Posts: 13

Rep: Reputation: 0
Quote:
Originally posted by btmiller
The value attribute is what actually gets past in the post or get request.
The value attribute doesn't need to be specified. If it wasn't set the text between <option>...</option> will be transmitted.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Receiving multiple messages with a php Server mrobertson Programming 30 06-13-2005 07:11 AM
Receiving Emails through web server? (PHP) gothgeek84 Programming 12 01-16-2005 03:02 PM
not receiving emails aroop Linux - Networking 1 09-30-2004 05:43 PM
Not receiving mail. latino Linux - Newbie 5 07-19-2004 03:21 PM
Receiving faxes Dutch3 Linux - Newbie 1 11-07-2002 10:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration