Click here to Skip to main content
11,922,026 members (56,833 online)
Rate this:
Please Sign up or sign in to vote.
See more: HTML PHP MySQL jQuery
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 4:39am

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

  Print Answers RSS
0 OriginalGriff 568
1 Dave Kreskowiak 285
2 Sergey Alexandrovich Kryukov 173
3 Richard MacCutchan 155
4 ppolymorphe 135
0 OriginalGriff 7,036
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,286
3 George Jonsson 2,840
4 Suvendu Shekhar Giri 2,216

Advertise | Privacy | Mobile
Web01 | 2.8.151120.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2015
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