smithdp1 Posted December 19, 2012 Author Share Posted December 19, 2012 I have a search results page that gives me a list of clients. If I check off the client they get added to a campaign. That is what I am trying to end up with. Quote Link to comment https://forums.phpfreaks.com/topic/272188-post-checked-values-to-mysql-jquery-serialize/page/2/#findComment-1400482 Share on other sites More sharing options...
codefossa Posted December 19, 2012 Share Posted December 19, 2012 It depends on if it's always the same, if you set the id, if it increments, etc. It's up to you and how you do it. Quote Link to comment https://forums.phpfreaks.com/topic/272188-post-checked-values-to-mysql-jquery-serialize/page/2/#findComment-1400489 Share on other sites More sharing options...
smithdp1 Posted December 19, 2012 Author Share Posted December 19, 2012 so is this close? <?php foreach($_POST['clientId'] as $key => $value) { $clientId = mysql_real_escape_string($value); $campaignId = mysql_real_escape_string($_POST['campaignId'][$key]); $data[] = "('$clientId','$campaignId')"; } $sql = "INSERT INTO `campaign_to_client` (clientId,campaignId) VALUES "; $sql .= implode(",",$data); ?> Quote Link to comment https://forums.phpfreaks.com/topic/272188-post-checked-values-to-mysql-jquery-serialize/page/2/#findComment-1400490 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.