1. data-ajax="false" in the form tag
2. jQuery 1.2 beta
3. removing all data-role="page" instances
4. dropping in a different form that worked in another project
5. dropping this form into another working project
<!DOCTYPE html>
<html>
<head>
<title>The Cursillo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name = "viewport" content = "width = device-width">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<link rel="stylesheet" href="ccss/cursillo.css" />
<link rel="apple-touch-icon" href="touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="touch-icon-iphone4.png" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="cjs/override.js"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
<script src="cjs/scripts.js"></script>
<script src="cjs/remyh5utils.js"></script>
</head>
<body>
...
<div data-role="page" id="sendpalanca" data-theme="e">
<div data-role="header" data-theme="e" style="padding:0px; margin:0px; border:0px;">
<img src="cimages/OC_Cursillo.png" style="padding:0px; margin:0px; border:0px; vertical-align:bottom;" />
</div><!-- /header -->
<div data-role="content">
<div class="content-primary">
<?php
//init variables
$cf = array();
$sr = false;
if(isset($_SESSION['cf_returndata'])){
$cf = $_SESSION['cf_returndata'];
$sr = true;
}
?>
<ul id="errors" class="<?php echo ($sr && !$cf['form_ok']) ? 'visible' : ''; ?>">
<li id="info">There were some problems with your form submission:</li>
<?php
if(isset($cf['errors']) && count($cf['errors']) > 0) :
foreach($cf['errors'] as $error) :
?>
<li><?php echo $error ?></li>
<?php
endforeach;
endif;
?>
</ul>
<p id="success">Thanks for your palanca! Your prayers and acts of mercy help to make Cursillo a truly heart felt experience all over the world.</p>
<form action="palanca.php" method="post" name="Palanca-form" data-ajax="false">
<h3>Step 1</h3>
<div data-role="fieldcontain">
<label for="selectmonth">Which month?<span class="required">*</span></label>
<select name="selectmonth" id="selectmonth" data-mini="true" required="required">
<option selected value="Select Month" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'Select Month') ? "selected='selected'" : '' ?>>Select Month</option>
<option value="January" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'January') ? "selected='selected'" : '' ?>>January</option>
<option value="February" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'February') ? "selected='selected'" : '' ?>>February</option>
<option value="March" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'March') ? "selected='selected'" : '' ?>>March</option>
<option value="April" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'April') ? "selected='selected'" : '' ?>>April</option>
<option value="May" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'May') ? "selected='selected'" : '' ?>>May</option>
<option value="June" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'June') ? "selected='selected'" : '' ?>>June</option>
<option value="July" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'July') ? "selected='selected'" : '' ?>>July</option>
<option value="August" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'August') ? "selected='selected'" : '' ?>>August</option>
<option value="September" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'September') ? "selected='selected'" : '' ?>>September</option>
<option value="October" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'October') ? "selected='selected'" : '' ?>>October</option>
<option value="November" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'Novmber') ? "selected='selected'" : '' ?>>November</option>
<option value="December" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['selectmonth'] == 'December') ? "selected='selected'" : '' ?>>December</option>
</select>
</div><!-- Step One Container -->
<h3>Step 2</h3>
<div data-role="fieldcontain">
<label for="holymasses">Holy Masses:</label>
<input type="range" name="holymasses" id="holymasses" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['holymasses'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="eucharist">Receiving Holy Eucharist:</label>
<input type="range" name="eucharist" id="eucharist" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['eucharist'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="rosaries">Rosaries:</label>
<input type="range" name="rosaries" id="rosaries" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['rosaries'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="chaplets">Chaplets:</label>
<input type="range" name="chaplets" id="chaplets" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['chaplets'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="stations">Stations of the Cross:</label>
<input type="range" name="stations" id="stations" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['stations'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="litany">Litanies:</label>
<input type="range" name="litany" id="litany" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['litany'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="novena">Novenas:</label>
<input type="range" name="novena" id="novena" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['novena'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="lithours">Liturgy of the Hours:</label>
<input type="range" name="lithours" id="lithours" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['lithours'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="exposed">Hours of Adoration (exposed):</label>
<input type="range" name="exposed" id="exposed" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['exposed'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="reposed">Visits to the Blessed Sacrament (reposed):</label>
<input type="range" name="reposed" id="reposed" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['reposed'] : '' ?> />
</div>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" data-type="horizontal" >
<legend>Sacrifices offered:</legend>
<label for="sacrifices" class="select">Sacrifices:</label>
<select name="sacrifices" id="sacrifices" data-mini="true">
<option value="Choose one" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacrifices'] == 'Choose one') ? "selected='selected'" : '' ?>>Choose one</option>
<option value="smoking" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacrifices'] == 'smoking') ? "selected='selected'" : '' ?>>smoking</option>
<option value="alchohol" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacrifices'] == 'alchohol') ? "selected='selected'" : '' ?>>alchohol</option>
<option value="sweets" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacrifices'] == 'sweets') ? "selected='selected'" : '' ?>>sweets</option>
<option value="soda" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacrifices'] == 'soda') ? "selected='selected'" : '' ?>>soda</option>
<option value="coffee" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacrifices'] == 'coffee') ? "selected='selected'" : '' ?>>coffee</option>
<option value="favorite food" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacrifices'] == 'food') ? "selected='selected'" : '' ?>>favorite food</option>
<option value="favorite TV show" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacrifices'] == 'favorite food') ? "selected='selected'" : '' ?>>favorite TV show</option>
<option value="car radio" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacrifices'] == 'car radio') ? "selected='selected'" : '' ?>>car radio</option>
<option value="other" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacrifices'] == 'other') ? "selected='selected'" : '' ?>>other</option>
</select>
<label for="sacdays">Days</label>
<select name="sacdays" id="sacdays" data-mini="true">
<option value="0" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '0') ? "selected='selected'" : '' ?>>0</option>
<option value="1" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '1') ? "selected='selected'" : '' ?>>1</option>
<option value="2" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '2') ? "selected='selected'" : '' ?>>2</option>
<option value="3" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '3') ? "selected='selected'" : '' ?>>3</option>
<option value="4" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '4') ? "selected='selected'" : '' ?>>4</option>
<option value="5" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '5') ? "selected='selected'" : '' ?>>5</option>
<option value="6" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '6') ? "selected='selected'" : '' ?>>6</option>
<option value="7" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '7') ? "selected='selected'" : '' ?>>7</option>
<option value="8" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '8') ? "selected='selected'" : '' ?>>8</option>
<option value="9" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '9') ? "selected='selected'" : '' ?>>9</option>
<option value="10" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '10') ? "selected='selected'" : '' ?>>10</option>
<option value="11" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '11') ? "selected='selected'" : '' ?>>11</option>
<option value="12" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '12') ? "selected='selected'" : '' ?>>13</option>
<option value="13" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '13') ? "selected='selected'" : '' ?>>14</option>
<option value="14" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '14') ? "selected='selected'" : '' ?>>15</option>
<option value="15" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '15') ? "selected='selected'" : '' ?>>15</option>
<option value="16" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '16') ? "selected='selected'" : '' ?>>16</option>
<option value="17" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '17') ? "selected='selected'" : '' ?>>17</option>
<option value="18" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '18') ? "selected='selected'" : '' ?>>18</option>
<option value="19" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '19') ? "selected='selected'" : '' ?>>19</option>
<option value="20" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '20') ? "selected='selected'" : '' ?>>20</option>
<option value="21" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '21') ? "selected='selected'" : '' ?>>21</option>
<option value="22" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '22') ? "selected='selected'" : '' ?>>22</option>
<option value="23" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '23') ? "selected='selected'" : '' ?>>23</option>
<option value="24" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '24') ? "selected='selected'" : '' ?>>24</option>
<option value="25" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '25') ? "selected='selected'" : '' ?>>25</option>
<option value="26" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '26') ? "selected='selected'" : '' ?>>26</option>
<option value="27" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '27') ? "selected='selected'" : '' ?>>27</option>
<option value="28" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '28') ? "selected='selected'" : '' ?>>28</option>
<option value="29" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '29') ? "selected='selected'" : '' ?>>29</option>
<option value="30" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '30') ? "selected='selected'" : '' ?>>30</option>
<option value="31" <?php echo ($sr && !$cf['form_ok'] && $cf['posted_form_data']['sacdays'] == '31') ? "selected='selected'" : '' ?>>31</option>
</select>
</fieldset>
</div>
<div data-role="fieldcontain">
<label for="miles">Miles driven for the Lord:</label>
<input type="range" name="miles" id="miles" value="0" min="00" max="1500" step="25" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['miles'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="vaca">Vacation days given in service of the Lord:</label>
<input type="range" name="vaca" id="vaca" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['vaca'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="personal">Personal Sacrifices:</label>
<input type="range" name="personal" id="personal" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['personal'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="works">Works of Mercy:</label>
<input type="range" name="works" id="works" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['works'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="prayer">Personal Prayer:</label>
<input type="range" name="prayer" id="prayer" value="0" min="0" max="31" data-highlight="true" data-mini="true" <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['prayer'] : '' ?> />
</div>
<div data-role="fieldcontain">
<label for="extraother">What other palanca have you offered?:</label>
<textarea name="extraother" id="extraother" placeholder="Use this field to tell us about palanca that isn't covered elsewhere in this form." <?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['extraother'] : '' ?> ></textarea>
</div>
</div><!-- Step Two Container -->
<h3>Step 3</h3>
<div data-role="fieldcontain">
<fieldset class="ui-grid-b">
<div class="ui-block-a"><button type="submit" data-theme="d" data-mini="true">Save</button></div>
<div class="ui-block-b"><button type="submit" data-theme="d" data-mini="true">Reset</button></div>
<div class="ui-block-c"><button type="submit" data-theme="b" name="submit" value="submit-value" data-mini="true">Submit</button></div>
</fieldset>
</div><!-- Step Three Container -->
</form>
<?php unset($_SESSION['cf_returndata']); ?>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape(''))</script>
<script src="cjs/plugins.js"></script>
<script src="cjs/script.js"></script>
</div><!--/content-primary -->
</div><!-- /content -->
<div data-role="footer" class="nav" data-id="nav-no-reload" data-theme="b" >
<div data-role="navbar" class="nav" data-grid="d">
<ul>
<li><a href="#index" id="cursillo" data-icon="custom">Home</a></li>
<li><a href="#group" id="grouping" data-icon="custom">Grouping</a></li>
<li><a href="#sendpalanca" id="palanca" data-icon="custom" class="ui-btn-active ui-state-persist">Palanca</a></li>
<li><a href="http://www.occursillo.org/occforum/calendar.php" id="events" data-icon="custom">Events</a></li>
<li><a href="#music" id="decolores" data-icon="custom">De Colores</a></li>
</ul>
</div><!-- /navbar -->
<span class="copyright">© 2012 Tim Bartel</span>
</div><!-- /footer -->
</div><!-- /page -->
...
</body>
</html>
<?php
if( isset($_POST) ){
//validation vars
$formok = true;
$errors = array();
//sumbission data
$ipaddress = $_SERVER['REMOTE_ADDR'];
$date = date('d/m/Y');
$time = date('H:i:s');
//form data
$selectmonth = $_POST['selectmonth'];
$holymasses = $_POST['holymasses'];
$eucharist = $_POST['eucharist'];
$rosaries = $_POST['rosaries'];
$stations = $_POST['stations'];
$litany = $_POST['litany'];
$novena = $_POST['novena'];
$lithours = $_POST['lithours'];
$exposed = $_POST['exposed'];
$reposed = $_POST['reposed'];
$sacrifices = $_POST['sacrifices'];
$sacdays = $_POST['sacdays'];
$miles = $_POST['miles'];
$vaca = $_POST['vaca'];
$personal = $_POST['personal'];
$works = $_POST['works'];
$prayer = $_POST['prayer'];
$rosaries = $_POST['rosaries'];
$extraother = $_POST['extraother'];
//validat data
//month is chosen
if($selectmonth == "Select Month")
{
$formok = false;
$errors[] = "You must select month";
}
//if sacrifices selected then days must accompany
elseif($sacrifices != "Choose one" && $sacdays == "0" )
{
$formok = false;
$errors[] = "You must choose the number of days for the Sacrifices Offered";
}
//send email if all is ok
if($formok)
{
ini_set("sendmail_from","info@timbartel.com");
$headers .= 'Content-type: text/html; charset=iso-8859-1' . " ";
$mailsubj = "Palanca from the Cursillo App";
$mailto = "magiclegoloom@gmail.com";
$emailbody = "<p>This palanca was submitted through the unofficial OC Cursillo mobile app created by Tim Bartel.</p>
<p>Sent from the IP Address: {$ipaddress} on {$date} at {$time}</p>
<p><strong>Month: </strong> {$selectmonth} <br />
<strong>Holy Masses: </strong> {$holymasses} <br />
<strong>Receiving Holy Eucharist: </strong> {$eucharist} <br />
<strong>Rosaries: </strong> {$rosaries} <br />
<strong>Chaplets: </strong> {$chaplets} <br />
<strong>Stations of the Cross: </strong> {$stations} <br />
<strong>Litanies: </strong> {$litany} <br />
<strong>Novenas: </strong> {$novena} <br />
<strong>Liturgy of the Hours: </strong> {$lithours} <br />
<strong>Hours of Adoration (exposed): </strong> {$exposed} <br />
<strong>Visits to the Blessed Sacrament (reposed): </strong> {$reposed} <br />
<strong>Sacrificed: </strong> {$sacrifices} for {$sacdays} days<br />
<strong>Miles driven for the Lord: </strong> {$miles} <br />
<strong>Vacation days given in service of th eLord: </strong> {$vaca} <br />
<strong>Personal sacrifices: </strong> {$personal} <br />
<strong>Works of mercy: </strong> {$works} <br /> </p>
<strong>Personal prayer: </strong> {$prayer} <br />
<p><strong>Other: </strong><br />{$extraother}s
</p>";
mail($mailto,$mailsubj,$emailbody,$headers);
}
//what we need to return back to our form
$returndata = array(
'posted_form_data' => array(
'selectmonth' => $selectmonth,
'holymasses' => $holymasses,
'eucharist' => $eucharist,
'rosaries' => $rosaries,
'stations' => $stations,
'litany' => $litany,
'novena' => $novena,
'lithours' => $lithours,
'exposed' => $exposed,
'reposed' => $reposed,
'sacrifices' => $sacrifices,
'sacdays' => $sacdays,
'miles' => $miles,
'vaca' => $vaca,
'personal' => $personal,
'works' => $works,
'prayer' => $prayer,
'rosaries' => $rosaries,
'extraother' => $extraother
),
'form_ok' => $formok,
'errors' => $errors
);
//if this is not an ajax request
if(empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest')
{
//set session variables
session_start();
$_SESSION['cf_returndata'] = $returndata;
//redirect back to form
header('location: ' . $_SERVER['HTTP_REFERER']);
}
}
?>