kfordham281 Posted November 9, 2006 Share Posted November 9, 2006 Bascially here's the situation. I've got a form feeding data to a mysql db which contains data that is feeding a googlemap that I've made. The website will have two of these google maps displaying different data and in different databases (same table/field structure in each db). I'd like to have one form to post the data (easier to maintain, less files, etc) so I need a way to select the database in the form so that the data gets sent to the right db. I've got includes which have the functions of opening the db, closing the db, and configuration of the db. I've commented out the db name in the config include ($dbname) and I'm trying to use a drop down to select the correct db. When I do this, I'm getting a "Error, insert query failed" error. It's likely because it doesn't know the db name to use. Can anyone help? Here is the code for the select statement. I'll gladly post any other code if necessary. ><select name="dbname" id="$dbname"> <option value="">Please Select ...</option> <option value="databasenameone">Ultra O-gaine</option> <option value="databasenametwo">Adventure24</option> </select> I'm basically a complete php newbie. I've been able to hack away at things thus far with finding code and tutorials on the net and adapting it to my situation but this one I can't seem to get right. Any help is much appreciated. Thanks! Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted November 10, 2006 Share Posted November 10, 2006 If I am understanding correctly, these: databasenameone databasenametwo cpanelname_database Quote Link to comment Share on other sites More sharing options...
kfordham281 Posted November 10, 2006 Author Share Posted November 10, 2006 Thanks for taking a look at it. I was testing the code locally so the db names don't have the cpanel name in them. Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted November 10, 2006 Share Posted November 10, 2006 Testing this: <html><!-- select.php --> <body> <FORM action="select.php" method="post"> <select name="dbname" id="<?php echo $dbname;?>"> <option value="">Please Select ...</option> <option value="databasenameone">Ultra O-gaine</option> <option value="databasenametwo">Adventure24</option> </select> <input type="submit" name="submit" value="Try Me!"> </form> <?php echo $dbname;?> </body> </html> Seems to work correctly. Unless you are printing the whole form with a php print statement, you need to break into php to put your variable in the there. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.