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.<br /><br />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?<br /><br />Here is the code for the select statement. I'll gladly post any other code if necessary.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><select name="dbname" id="$dbname"><br />Â Â Â Â Â Â Â Â Â Â <option value="">Please Select ...</option><br />Â Â Â Â Â Â Â Â Â Â <option value="databasenameone">Ultra O-gaine</option><br />Â Â Â Â Â Â Â Â Â Â <option value="databasenametwo">Adventure24</option><br />Â Â Â Â Â Â Â Â </select><!--c2--></div><!--ec2--><br /><br />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!<!--content-->
If I am understanding correctly, these:<br />databasenameone<br />databasenametwo<br /><br />cpanelname_database<!--content-->
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.<!--content-->
Testing this:<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><html><br /><!-- select.php --><br /><body><br /><FORM action="select.php" method="post"><br /><select name="dbname" id="<b><?php echo $dbname;?></b>"><br /> <option value="">Please Select ...</option><br /> <option value="databasenameone">Ultra O-gaine</option><br /> <option value="databasenametwo">Adventure24</option><br /></select><br /><input type="submit" name="submit" value="Try Me!"> <br /></form><br /><?php echo $dbname;?><br /></body><br /></html><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />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.<!--content-->
If I am understanding correctly, these:<br />databasenameone<br />databasenametwo<br /><br />cpanelname_database<!--content-->
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.<!--content-->
Testing this:<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><html><br /><!-- select.php --><br /><body><br /><FORM action="select.php" method="post"><br /><select name="dbname" id="<b><?php echo $dbname;?></b>"><br /> <option value="">Please Select ...</option><br /> <option value="databasenameone">Ultra O-gaine</option><br /> <option value="databasenametwo">Adventure24</option><br /></select><br /><input type="submit" name="submit" value="Try Me!"> <br /></form><br /><?php echo $dbname;?><br /></body><br /></html><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />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.<!--content-->