Click here to Skip to main content
13,048,584 members (93,722 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have a jquery mobile project and I have three buttons grouped horizontally. When the far left or far right button are clicked the text in the middle button increases or decreases. When I try to submit the text as an int to MySQL database through php, I get the value 0 inserted into the field. Obviously #seatCounter2 is not getting a value. How can I get the value of #seatCounter2?
Any help/advice would be appreciated.

<fieldset class="ui-grid-a" style="margin-removed10px" >
    <label for="name" class="ui-block-a" date-inline="true" style="margin-top:5px">Seats Available</label>
    <div data-role="controlgroup" data-type="horizontal" date-inline="true" class="ui-block-b" >
        <a id="seatIncrease" data-role="button" style="width:2.8em" data-theme="c">+</a>
        <a href="#" id="seatCounter" data-role="button" style="width:50px; height:39px" data-theme="b"><span id="seatCounter2" name="seatCounter2" style="margin-removed10px, padding-removed35px">1</span></a>
        <a id="seatDecrease" data-role="button" style="width:2.8em" data-theme="c">-</a>

// Seat available Counter
        $("#seatCounter2").text( Number($("#seatCounter2").text()) + 1 );
        $("#seatCounter2").text( Math.max(1, Number($("#seatCounter2").text()) - 1) );													

$seatcounter = intval($_POST['seatCounter2']);
//will only get executed if true
if ($canSubmitForm)
	if ($isFormEmpty == false)
	$query = "INSERT INTO journey
		VALUES('$pjFrom','$pjTo','$radioJourneyType', STR_TO_DATE('$departDate','%d/%m/%Y'),'$newDepTime',STR_TO_DATE('$returnDate','%d/%m/%Y'),'$newRetTime ','$seatcounter','$textareanotes','$radUserType')";
	$error = "Invalid product data. Check all fields and try again.";
Posted 28-Mar-13 3:39am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100