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. 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. 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); ?> 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
Archived
This topic is now archived and is closed to further replies.