Ok, so what you're saying is.
This script
<br />
function dump(arr,level) {<br />
var dumped_text = "";<br />
if(!level) level = 0;<br />
<br />
//The padding given at the beginning of the line.<br />
var level_padding = "";<br />
for(var j=0;j<level+1;j++) level_padding += " ";<br />
<br />
if(typeof(arr) == 'object') { //Array/Hashes/Objects <br />
for(var item in arr) {<br />
var value = arr[item];<br />
<br />
if(typeof(value) == 'object') { //If it is an array,<br />
dumped_text += level_padding + "'" + item + "' ...\n";<br />
dumped_text += dump(value,level+1);<br />
} else {<br />
dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";<br />
}<br />
}<br />
} else { //Stings/Chars/Numbers etc.<br />
dumped_text = "===>"+arr+"<===("+typeof(arr)+")";<br />
}<br />
return dumped_text;<br />
}<br />
$(document).ready(function() {<br />
$('div.message-error').hide();<br />
$('div.message-success').hide();<br />
$('li').remove('.titleName'); <br />
$('li').remove('.stipulationName');<br />
$('li').remove('.competitorName');<br />
<br />
for ( var matchNum = 0; matchNum < <?php echo $numMatches ?>; matchNum++ ) {<br />
var titlesCount = $('ul#titlesDefended'+ matchNum +' li').size();<br />
if(titlesCount == 0){$('ul#titlesDefended'+ matchNum).append('<li titleID="0" class="notitle">There are no titles being defended.');}<br />
var stipulationsCount = $('ul#stipulationsAdded'+ matchNum +' li').size();<br />
if(stipulationsCount == 0){$('ul#stipulationsAdded'+ matchNum).append('<li stipulationID="0" class="nostipulation">There are no stipulations for this match.');}<br />
var competitorsCount = $('ul#competitors'+ matchNum +' li').size();<br />
if(competitorsCount == 0){$('ul#competitors'+ matchNum).append('<li competitorID="0" class="nocompetitor">There are no competitors for this match.');}<br />
}<br />
<br />
$("#bookerForm").validate({ <br />
rules: {<br />
introduction: {<br />
required: true<br />
},<br />
matchtypeID: {<br />
required: true<br />
},<br />
liCompetitors: {<br />
required: true<br />
},<br />
matchwriterID: {<br />
required: true<br />
},<br />
matchTitle: {<br />
required: true<br />
},<br />
preview: {<br />
required: true<br />
},<br />
segment: {<br />
required: true<br />
}<br />
},<br />
messages: {<br />
introduction: "Please enter the event introduction!",<br />
matchtypeID: "Please choose the type of match!",<br />
liCompetitors: "Please choose atleast 2 competitors!",<br />
matchwriterID: "Please choose a match writer!",<br />
matchTitle: "Please enter a match title!",<br />
preview: "Please enter a preview!",<br />
segment: "Please choose a segment writer!"<br />
},<br />
submitHandler: function(form) {<br />
var eventName = $("#event").val();<br />
var eventID = $("#eventID").val();<br />
var introduction = $("#introduction").val();<br />
var subArray = new Array;<br />
var matchArray = new Array;<br />
var matchArrayIndex = 0;<br />
var segmentArray = new Array;<br />
var segmentArrayIndex = 0;<br />
var matchNumX = new Array;<br />
var matchTypeIDX = new Array;<br />
var titlesIDListX = new Array;<br />
var stipulationsIDListX = new Array;<br />
var competitorsIDListX = new Array;<br />
var matchWriterIDX = new Array;<br />
var matchTitleX = new Array;<br />
var previewX = new Array; <br />
var segmentNumX = new Array;<br />
var segmentWriterIDX = new Array;<br />
var segmentOrderX = new Array;<br />
var typeX = new Array;<br />
var typeX2 = new Array;<br />
var i = 0;<br />
<br />
for(i=0;i<<?php echo $numMatches ?>; i++) {<br />
<br />
var matchNum = i + 1;<br />
var matchTypeID = $('select#matchTypeDrop'+ matchNum).val(); <br />
var liTitles = $('ul#titlesDefended'+ matchNum +' li');<br />
var titlesIDList = "";<br />
var j = 0;<br />
$('ul#titlesDefended'+ matchNum +' li').each(function(){<br />
var liTitle = $( liTitles[ j ] );<br />
<br />
// only start appending commas in after the first characterID<br />
if( j > 0 ) {<br />
titlesIDList += ","; <br />
}<br />
<br />
// append the current li element's characterID to the list<br />
titlesIDList += liTitle.attr( 'titleID' );<br />
j++;<br />
});<br />
var j = 0;<br />
var liStipulations = $('ul#stipulationsAdded'+ matchNum +' li');<br />
//alert(liStipulations);<br />
var stipulationsIDList = "";<br />
$('ul#stipulationsAdded'+ matchNum +' li').each(function(){<br />
var liStipulation = $( liStipulations[ j ] );<br />
//alert(liStipulation);<br />
<br />
// only start appending commas in after the first characterID<br />
if( j > 0 ) {<br />
stipulationsIDList += ","; <br />
}<br />
<br />
// append the current li element's characterID to the list<br />
stipulationsIDList += liStipulation.attr( 'stipulationID' );<br />
//alert(liStipulation.attr( 'stipulationID' ));<br />
j++;<br />
});<br />
//alert(stipulationsIDList);<br />
var j = 0;<br />
var liCompetitors = $('ul#competitors'+ matchNum +' li');<br />
var competitorsIDList = "";<br />
$('ul#competitors'+ matchNum +' li').each(function(){<br />
var liCompetitor = $( liCompetitors[ j ] );<br />
<br />
// only start appending commas in after the first characterID<br />
if( j > 0 ) {<br />
competitorsIDList += ","; <br />
}<br />
<br />
// append the current li element's characterID to the list<br />
competitorsIDList += liCompetitor.attr( 'competitorID' );<br />
j++;<br />
});<br />
var matchWriterID = $('select#matchWriter' + matchNum + '').val();<br />
var matchTitle = $('input#matchTitle'+ matchNum +'').val();<br />
var preview = $('textarea#preview'+ matchNum +'').val();<br />
var type = $("input#type").val();<br />
typeX.push(type);<br />
matchNumX.push(matchNum);<br />
matchTypeIDX.push(matchTypeID);<br />
titlesIDListX.push(titlesIDList);<br />
stipulationsIDListX.push(stipulationsIDList);<br />
competitorsIDListX.push(competitorsIDList);<br />
matchWriterIDX.push(matchWriterID);<br />
matchTitleX.push(matchTitle);<br />
previewX.push(preview);<br />
matchArray[matchArrayIndex] = new Object();<br />
matchArray[matchArrayIndex]['type'] = typeX; <br />
matchArray[matchArrayIndex]['matchNum'] = matchNumX;<br />
matchArray[matchArrayIndex]['matchtypeID'] = matchTypeIDX;<br />
matchArray[matchArrayIndex]['titlesIDList'] = titlesIDListX;<br />
matchArray[matchArrayIndex]['stipulationsIDList'] = stipulationsIDListX;<br />
matchArray[matchArrayIndex]['competitorsIDList'] = competitorsIDListX;<br />
matchArray[matchArrayIndex]['matchWriterID'] = matchWriterIDX;<br />
matchArray[matchArrayIndex]['matchTitle'] = matchTitleX;<br />
matchArray[matchArrayIndex]['preview'] = previewX;<br />
}<br />
for(i=0;i<<?php echo $numSegments ?>; i++) {<br />
var segmentNum = i + 1;<br />
var segmentWriterID = $('select#segmentWriter' + segmentNum + '').val();<br />
var segmentOrder = $('select#segmentOrder' + segmentNum + '').val();<br />
var type = $("input#type2").val();<br />
typeX2.push(type);<br />
segmentNumX.push(segmentNum);<br />
segmentWriterIDX.push(segmentWriterID);<br />
segmentOrderX.push(segmentOrder);<br />
segmentArray[segmentArrayIndex] = new Object(); <br />
segmentArray[segmentArrayIndex]['type'] = typeX2; <br />
segmentArray[segmentArrayIndex]['segmentNumber'] = segmentNumX;<br />
segmentArray[segmentArrayIndex]['segmentWriterID'] = segmentWriterIDX;<br />
segmentArray[segmentArrayIndex]['segmentOrder'] = segmentOrderX;<br />
}<br />
alert(dump(matchArray));<br />
alert(dump(segmentArray));<br />
var dataString = 'masterArray=' + masterArray;<br />
dataString += '&eventID=' + eventID + '&submitBooking=True'; <br />
$.ajax({<br />
type: "POST",<br />
url: "processes/bookings.php",<br />
data: dataString, <br />
success: function() {<br />
$('div.message-error').hide();<br />
$("div.message-success").html("<h6>Operation successful<p>" + eventName + " saved successfully.");<br />
$("div.message-success").show().delay(10000).hide("slow");<br />
return true;<br />
}<br />
});<br />
return false; <br />
} <br />
});<br />
});<br />
Card Lineup for
</pre>
<form action="#" id="bookerForm">
Introduction
Introduction:
Required
Match #
Match Type:
- Select -
mysqli_data_seek( $matchtypesResult, 0 );
while ( $row = mysqli_fetch_array ( $matchtypesResult, MYSQL_ASSOC ) ) {
print "".$row['matchType']."\r";
}
?>
Required
Title On The Line:
- Select -
mysqli_data_seek( $titlesResult, 0 );
while ( $row = mysqli_fetch_array ( $titlesResult, MYSQL_ASSOC ) ) {
print "".$row['titleName']."\r";
}
?>
Stipulation:
- Select -
mysqli_data_seek( $stipulationsResult, 0 );
while ( $row = mysqli_fetch_array ( $stipulationsResult, MYSQL_ASSOC ) ) {
print "".$row['stipulation']."\r";
}
?>
Competitors:
- Select -
mysqli_data_seek( $charactersResult, 0 );
while ( $row = mysqli_fetch_array ( $charactersResult, MYSQL_ASSOC ) ) {
print "".$row['characterName']."\r";
}
?>
Required
Match Writer:
- Select -
mysqli_data_seek( $matchwriterResult, 0 );
while ( $row = mysqli_fetch_array ( $matchwriterResult, MYSQL_ASSOC ) ) {
print "".$row['name']."\r";
}
?>
Required
Match Title
Required
Preview:
Required
}
?>
0) { ?>
Segment
Segment Writer:
- Select -
mysqli_data_seek( $matchwriterResult, 0 );
while ( $row = mysqli_fetch_array ( $matchwriterResult, MYSQL_ASSOC ) ) {
print "".$row['name']."\r";
}
?>
Required
Segment After:
- Select -
Introduction
for( $j = 1; $j print "Match $j\r";
}
?>
Required
} ?>
</form>
<br><br><br><br><div class="message message-error">
Required field missing
Please fill in all required fields.
</div>
<br><div class="message message-success">
Operation succesful
Booking was added to the database.
</div>
<b
outputs this
'0' ...
'type' ...
'0' => "Match"
'1' => "Match"
'matchNum' ...
'0' => "1"
'1' => "2"
'matchtypeID' ...
'0' => "1"
'1' => "1"
'titlesIDList' ...
'0' => "3,2"
'1' => "3,2"
'stipulationsIDList' ...
'0' => "2,1"
'1' => "2,1"
'competitorsIDList' ...
'0' => "10,3"
'1' => "11,1"
'matchWriterID' ...
'0' => "1"
'1' => "1"
'matchTitle' ...
'0' => "match title1"
'1' => "match title2"
'preview' ...
'0' => "preview1"
'1' => "preview2"
'0' ...
'type' ...
'0' => "Segment"
'1' => "Segment"
'segmentNumber' ...
'0' => "1"
'1' => "2"
'segmentWriterID' ...
'0' => "1"
'1' => "1"
'segmentOrder' ...
'0' => "introduction"
'1' => "1"
but you want it to output this?
BEFORE ORDERING
Introduction
Type- Introduction
segmentTitle- Introduction
preview- This is just a test preview for the next event. Hope you all come out to see us wrestle!
Match #1
type- Match
matchNum- 1
matchTitle- Match Title 1
competitorsIDList- 1,2
matchwriterID- 1
preview- This is the preview for match #1.
stipulationsIDList- 0
matchTypeID- 1
titlesIDList- 0
Match #2
type- Match
matchNum- 1
matchTitle- Match Title 2
competitorsIDList-1,2,3
matchwriterID- 1
preview- This is the preview for match #2.
stipulationsIDList- 2,3
matchTypeID- 3
titlesIDList- 1
Match #3
type- Match
matchNum- 1
matchTitle- Match Title 3
competitorsIDList- 1,2
matchwriterID- 3
preview- This is the preview for match #3.
stipulationsIDList- 4,6
matchTypeID- 1
titlesIDList- 2
Match #4
type- Match
matchNum- 1
matchTitle- Match Title 4
competitorsIDList- 1,2
matchwriterID- 1
preview- This is the preview for match #4.
stipulationsIDList- 4,6
matchTypeID- 1
titlesIDList- 0
Match #5
type- Match
matchNum- 1
matchTitle- Match Title 5
competitorsIDList- 1,2
matchwriterID- 2
preview- This is the preview for match #5.
stipulationsIDList- 0
matchTypeID- 1
titlesIDList- 3
Match #6
type- Match
matchNum- 1
matchTitle- Match Title 6
competitorsIDList- 1,2
matchwriterID- 2
preview- This is the preview for match #6.
stipulationsIDList- 3,5
matchTypeID- 1
titlesIDList-2
Match #7
type- Match
matchNum- 1
matchTitle- Match Title 7
competitorsIDList- 1,2
matchwriterID- 3
preview- This is the preview for match #7.
stipulationsIDList- 0
matchTypeID- 1
titlesIDList- 1
Segment #1
type- Segment
segmentNum- 1
segmentWriterID- 1
segmentOrder (matchNum or Introduction)- introduction
Segment #2
type- Segment
segmentNum- 2
segmentWriterID- 2
segmentOrder (matchNum or Introduction)- 1
Segment #3
type- Segment
segmentNum- 3
segmentWriterID- 2
segmentOrder (matchNum or Introduction)- 1
Segment #4
type- Segment
segmentNum- 4
segmentWriterID- 1
segmentOrder (matchNum or Introduction)- 3
Segment #5
type- Segment
segmentNum- 5
segmentWriterID- 1
segmentOrder (matchNum or Introduction)-6
AFTER ORDERING
Introduction
Type- Introduction
segmentTitle- Introduction
preview- This is just a test preview for the next event. Hope you all come out to see us wrestle!
Segment #1
type- Segment
segmentNum- 1
segmentWriterID- 1
segmentOrder (matchNum or Introduction)- introduction
Match #1
type- Match
matchNum- 1
matchTitle- Match Title 1
competitorsIDList- 1,2
matchwriterID- 1
preview- This is the preview for match #1.
stipulationsIDList- 0
matchTypeID- 1
titlesIDList- 0
Segment #2
type- Segment
segmentNum- 2
segmentWriterID- 2
segmentOrder (matchNum or Introduction)- 1
Segment #3
type- Segment
segmentNum- 3
segmentWriterID- 2
segmentOrder (matchNum or Introduction)- 1
Match #2
type- Match
matchNum- 1
matchTitle- Match Title 2
competitorsIDList-1,2,3
matchwriterID- 1
preview- This is the preview for match #2.
stipulationsIDList- 2,3
matchTypeID- 3
titlesIDList- 1
Match #3
type- Match
matchNum- 1
matchTitle- Match Title 3
competitorsIDList- 1,2
matchwriterID- 3
preview- This is the preview for match #3.
stipulationsIDList- 4,6
matchTypeID- 1
titlesIDList- 2
Segment #4
type- Segment
segmentNum- 4
segmentWriterID- 1
segmentOrder (matchNum or Introduction)- 3
Match #4
type- Match
matchNum- 1
matchTitle- Match Title 4
competitorsIDList- 1,2
matchwriterID- 1
preview- This is the preview for match #4.
stipulationsIDList- 4,6
matchTypeID- 1
titlesIDList- 0
Match #5
type- Match
matchNum- 1
matchTitle- Match Title 5
competitorsIDList- 1,2
matchwriterID- 2
preview- This is the preview for match #5.
stipulationsIDList- 0
matchTypeID- 1
titlesIDList- 3
Match #6
type- Match
matchNum- 1
matchTitle- Match Title 6
competitorsIDList- 1,2
matchwriterID- 2
preview- This is the preview for match #6.
stipulationsIDList- 3,5
matchTypeID- 1
titlesIDList-2
Segment #5
type- Segment
segmentNum- 5
segmentWriterID- 1
segmentOrder (matchNum or Introduction)-6
Match #7
type- Match
matchNum- 1
matchTitle- Match Title 7
competitorsIDList- 1,2
matchwriterID- 3
preview- This is the preview for match #7.
stipulationsIDList- 0
matchTypeID- 1
titlesIDList- 1