| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Member | Populate a dropdown for PHP form Hi can any one tell me how to populate a drop down for a php form? you can see the one I have done on my website: http://www.greylizard.net/linkdirectory/addyourlink.php the form works ok but just the dropdown has no php form values, and I can't work out how to add those Thanks Justin |
| |
| | #2 (permalink) |
| Professional Monkey | i dont quite know what you mean but this is the code for a drop down list PHP Code:
__________________ [http://www.webmasterwords.com/python-split-and-join-examples]Python Tutorials[/url] |
| |
| | #3 (permalink) |
| NamePros Member | Yes that is what I have at the moment. I am not sure the best way to describe it, it's just that when someone selects the dropdown and sends the form the value they selected with the dropdown is not transmitted along with the other items which have nice php values handled by the post and mail functions which I have built in o.k. some code from the page: // Handle POST method. if ($_POST) { $name = $_POST['name']; $email = $_POST['email']; $linkname = $_POST['linkname']; $url = $_POST['url']; $description = $_POST['description']; $category = $_POST['category']; $categorysug = $_POST['categorysug']; $linkback = $_POST['linkback']; // Compose simple text message: $message = "linkdirectory\r\n Name: $name\r\n email: $email\r\n Link name: $linkname\r\n URL: $url\r\n Description: $description\r\n Category: $category\r\n Category Sug: $categorysug\r\n Link back: $linkback\r\n "; // Send message to bob@microsoft.com mail("linkdirectory@greylizard.net", "Link Directory Add", $message); // Thank the generous user echo "<h2>Your information has been submitted, thank you.</h2>\n"; } else { ?> <div align="center"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td> <form action="<?= $PHP_SELF ?>" method="post"> <table border="0" cellspacing="0" cellpadding="3"> <tr> <td><font size="-1">Your name</font></td> <td><font size="-1"> <input name="name" type="text" > </font></td> </tr> <tr> <td><font size="-1">e-mail</font></td> <td><font size="-1"> <input name="email" type="text" > </font></td> </tr> <tr> <td><font size="-1">Site name</font></td> <td><font size="-1"> <input name="linkname" type="text" size="40" > </font></td> </tr> <tr> <td><font size="-1">URL to add</font></td> <td><font size="-1"> <input name="url" type="text" size="40" > </font></td> </tr> <tr> <td><font size="-1">Short description</font></td> <td><font size="-1"> <input name="description" type="text" size="50" > </font></td> </tr> <tr> <td><font size="-1">Category</font></td> <td><select name="categroy"> <option>Automotive</option> <option>Alternative</option> <option>Music</option> <option>Online shops</option> <option>Travel</option> <option>Cats</option> <option>Webdesign</option> <option>Personal sites</option> <option>Misc</option> <option>Adult</option> </select> <font size="-1">(or suggested) <input name="categorysug" type="text" > </font></td> </tr> <tr> <td><font size="-1">Link back URL</font></td> <td><font size="-1"> <input name="linkback" type="text" size="40" > </font></td> </tr> </table> <p><font size="-1">Please allow 1 week to be included, link back preferred (<a href="linkback.html" target="_blank"><u>options</u></a>).<br> Submission at discretion of webmaster and does not guarantee listing.</font></p> <p> <input type="submit" value="Submit"> <input type="reset" value="Reset"> </p> </form></td> </tr> </table> |
| |
| | #4 (permalink) |
| Professional Monkey | i think this is what your looking for PHP Code:
__________________ [http://www.webmasterwords.com/python-split-and-join-examples]Python Tutorials[/url] |
| |
| | #5 (permalink) |
| NamePros Member | So... how does that differ to what I have?.... // Handle POST method. if ($_POST) { $category = $_POST['category']; // Compose simple text message: Category: $category\r\n "; --snip-- // Send message mail("myname@mydomain.net", "Link Directory Add", $message); --snip-- <form action="<?= $PHP_SELF ?>" method="post"> <select name="categroy"> <option>Automotive</option> <option>Alternative</option> <option>Music</option> <option>Online shops</option> <option>Travel</option> <option>Cats</option> <option>Webdesign</option> <option>Personal sites</option> <option>Misc</option> <option>Adult</option> </select> <input type="submit" value="Submit"> <input type="reset" value="Reset"> |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Paypal Settlement | CMachuca | The Break Room | 3 | 07-31-2004 10:14 PM |
| PAYPAL Litigation | johnn | Domain Name Discussion | 6 | 07-31-2004 09:51 PM |
| Paypal Settlement | Lord | The Break Room | 2 | 07-30-2004 09:30 PM |