Paul_W Posted August 17, 2006 Share Posted August 17, 2006 So I'm trying to work out an issue on a project which requires to post some data from a form and send it to multiple databases via several user selected checkboxes. I think I have this somewhat figured out but could use some help making sure it looks ok and I'm doing things the right way. Would appreciate some input if anyone has some ideas how to do this better or what have you... thanks very much!!So the form itself is fairly straight forward:<FORM action="process.php" method="post" name="frmJob">...bunch of text areas and other checkboxes...<input type="checkbox" class="radio" name="post_1" id="id_a" value="1"<?php if($t_result['post_1'] == "1") { echo " checked";}?>></FORM>so in process.php I have this:$query = '<Database INSERT/UPDATE query here>'; if(isset($_POST['post_1'])) {// connect to db 1$db_link = mysql_connect ( $db_hostname, $db_server_username, $db_server_password ); if ( $db_link ) { if ( ! mysql_select_db ( $db_database ) ){ die("Mysql connection failed"); } else{ mysql_query($query); //close the database connection @mysql_close ( $db_link ); //connect back to normal database server xx_db_connect() or die('Unable to connect to database server!'); } } else { die("Mysql connection failed");repeat for more checkboxes....One thing I'm curious about is can I use a function in the $query = ''; so something like this$query = 'db_insert(compid,title,categoryid,subcategoryid,description,locationid,skills)';Any further examples or comments or suggestions are welcome!!!Thanks,Paul Quote Link to comment Share on other sites More sharing options...
Jeremysr Posted August 17, 2006 Share Posted August 17, 2006 I think it should work if you remove the quotes:[code=php:0]$query = db_insert(compid,title,categoryid,subcategoryid,description,locationid,skills);[/code] 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.