NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP Contact Form

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
6 members in live chat ~  


Reply
 
LinkBack Thread Tools
Old 09-30-2011, 07:30 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
hoops's Avatar
Join Date: Sep 2006
Posts: 449
hoops is a jewel in the roughhoops is a jewel in the roughhoops is a jewel in the rough
 



PHP Contact Form


I have this code in my contact form and it doesn't post correctly.

<label for="select-choice"></label>
<select id="selected" name="selected" class="select" value="test">
<option value="">General</option>
<option value="email 2">Service/Support</option>
<option value="email 3">Estimate/Quote</option>
</select>

Can anyone tell me the Post code for a drop down menu please?
hoops is offline   Reply With Quote
Old 10-01-2011, 10:22 AM   #2 (permalink)
NamePros Regular
 
pixelhero's Avatar
Join Date: May 2008
Location: England
Posts: 771
pixelhero is a name known to allpixelhero is a name known to allpixelhero is a name known to allpixelhero is a name known to allpixelhero is a name known to allpixelhero is a name known to all
 


Help The Homeless - Holiday 2009
can you show the whole form so we can see where it fits in the form?

Also, for="" should contain the ID of the input it is the label for if you want to change that to be correct.
pixelhero is offline   Reply With Quote
Old 10-03-2011, 08:14 PM   #3 (permalink)
 
BillyConnite's Avatar
Join Date: Jul 2005
Location: Coffs H, Australia
Posts: 3,456
BillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond repute
 


Wildlife Parkinson's Disease Parkinson's Disease
Would be nice to have some more info hoops. The entire form code as pixelhero suggested would be nice.

And exactly how is it not posting correctly? Are there any values for $_POST['selected']?

Possible problems I can see is that you have given your drop-down a static value in the opening select tag (No need to give the select tag a value, if you want a default value to be set, simply add " selected" in one of the option tags), and I would also stay away from naming your drop-downs "selected", although this probably isn't an issue.

Here is an example of a working drop-down form (tested):
PHP Code:
<?php
????: NamePros.com http://www.namepros.com/programming/732607-php-contact-form.html

    
if(isset($_POST['dropdown']))
    {
    echo 
$_POST['dropdown'] ."<br />";
    }

?>
<form name="dropdowntest" method="post" action="test.php">
<select id="dropdown" name="dropdown">
<option value="email1" selected>General</option>
<option value="email2">Service/Support</option>
<option value="email3">Estimate/Quote</option>
</select>
<input type="submit" value="Submit" />
</form>
Note in the above, the first option contains " selected" in the opening tag, at the end, this specifies it as the default value.

Hope this helps,
Rhett.
BillyConnite is offline   Reply With Quote
Old 10-30-2011, 11:02 PM   #4 (permalink)
Senior Member
 
Nodws's Avatar
Join Date: Jun 2008
Location: nodws.com
Posts: 1,666
Nodws has much to be proud ofNodws has much to be proud ofNodws has much to be proud ofNodws has much to be proud ofNodws has much to be proud ofNodws has much to be proud ofNodws has much to be proud ofNodws has much to be proud ofNodws has much to be proud ofNodws has much to be proud of
 



Save a Life
the SELECT tag should not have a value.
__________________
Nodws is offline   Reply With Quote
Old 11-08-2011, 10:48 PM   #5 (permalink)
New Member
Join Date: Aug 2010
Location: US
Posts: 21
stevemack is an unknown quantity at this point
 



is it so that the SELECT tag should not have any value..?
stevemack is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
[4HIRE] PHP / MySQL / Javascript - Frameworks and OOP alecksmart Developers For Hire 0 06-24-2011 12:47 AM
Hoax or not?? Paypal "GIFT option" with a riduculous contact form? mitch007 The Break Room 4 06-20-2011 02:23 PM
Looking for a PHP Developer for my team! domainpush Web Development Wanted 1 06-18-2011 06:51 PM

 
All times are GMT -7. The time now is 02:49 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger