Retaining values passed at end of URL after form submission

4 posts by 2 authors in: Forums > CMS Builder
Last Post: October 9, 2013   (RSS)

By Daryl - October 9, 2013

Hi Jerry,

What I would do is I will capture the date_year value and date_month value and put them in a hidden field in the  $order_by request form.

<form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="date_year" value="<?php echo @$_REQUEST['date_year']; ?>">
<input type="hidden" name="date_month" value="<?php echo @$_REQUEST['date_month']; ?>">
<select name="order">
<option value="b">earliest date at the top</option>
<option value="a">most recent date at the top</option>
</select>
<input type="submit" name="submit" value="Click/Tap To Choose Display Order">
</form>

Hope this helps.

Cheers!

Daryl Maximo
PHP Programmer - interactivetools.com

By gkornbluth - October 9, 2013 - edited: October 9, 2013

Hi Daryl,

Thanks for the insight. I'll give it a try in the morning.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gkornbluth - October 9, 2013

Well I couldn't wait and I gave it a try.

Worked like a charm

Thank you Daryl.

The code on blog 3 is now

<span class="heading_font">Have It Your Way</span><br />
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">

  <select name="order">
    <option value="b">earliest date at the top</option>
    <option value="a">most recent date at the top</option>
  </select>
  <input type="submit" name="submit" value="Click/Tap To Choose Display Order">
</form>
<?php $orderBy = "date";
if (@$FORM['order'] == 'b') { $orderBy = "date"; }
if (@$FORM['order'] == 'a') { $orderBy = "date DESC"; }

?>
<?php $record_limit = $common_informationRecord['record_limit'] ?>
<?php if (@!$record_limit ) { $record_limit1 = ""; } ?>
<?php if (@$record_limit >=1 ) { $record_limit1 = $common_informationRecord['record_limit']; } ?>
<br>
<?php // load records from 'blog'
  list($blogRecords, $blogMetaData) = getRecords(array(
    'tableName'   => 'blog',
    'loadUploads' => true,
    'allowSearch' => false,
    'orderBy' => $orderBy,
    'limit' => $record_limit1,
  ));
 
  ?>

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php