Zen Cart Logo
Forums / Contribution-Writing Guidelines / Odd extra elements in URL after form submission

Odd extra elements in URL after form submission

Views: 11,185

Results 1 to 6 of 6
28 Aug 2014, 5:49 AM
#1
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Odd extra elements in URL after form submission

I have been rewriting the Orders Export mod and have an odd situation.
http://www.zen-cart.com/showthread.php?193168-Orders-Exporter-Module&p=1256922#post1256922
I should have started this question here so as not to repeat myself.

When selecting an export range, two odd elements are added to the URL in the address bar. They vary seemingly at random in the numbers, but always look like ...&x=23&y=9.
For example:```
http://localhost/zc151/my_admin/orders_export.php?from_oid=1&to_oid=99&x=38&y=6

I don't know what in the form submission would insert that, and would like to eliminate it.```php
    <div class="oidSetting"> <!-- Order ID setting inputs -->
      <h2><?php echo ORDERSEXPORT_PAGE_HEADING_OID; ?></h2>
      <?php echo zen_draw_form('oid_range', FILENAME_ORDERSEXPORT, '', 'get');
      echo '<div class="oidInput">' . OEX_FROM_OID_PRE . zen_draw_input_field('from_oid', $limits['orders_id'][0], 'size="10"') . '</div>';
      echo '<div class="oidInput">' . OEX_TO_OID_PRE . zen_draw_input_field('to_oid', $limits['orders_id'][1], 'size="10"') . '</div>';
      echo '<div class="oidSubmit">' . zen_image_submit('button_save.gif', IMAGE_SAVE) . '</div>';//form submit
      echo '</form>';?>
    </div>
28 Aug 2014, 11:14 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Odd extra elements in URL after form submission

gjh42:

I have been rewriting the Orders Export mod and have an odd situation.
http://www.zen-cart.com/showthread.php?193168-Orders-Exporter-Module&p=1256922#post1256922
I should have started this question here so as not to repeat myself.

When selecting an export range, two odd elements are added to the URL in the address bar. They vary seemingly at random in the numbers, but always look like ...&x=23&y=9.
For example:```
http://localhost/zc151/my_admin/orders_export.php?from_oid=1&to_oid=99&x=38&y=6

> I don't know what in the form submission would insert that, and would like to eliminate it.```php
    <div class="oidSetting"> <!-- Order ID setting inputs -->
      <h2><?php echo ORDERSEXPORT_PAGE_HEADING_OID; ?></h2>
      <?php echo zen_draw_form('oid_range', FILENAME_ORDERSEXPORT, '', 'get');
      echo '<div class="oidInput">' . OEX_FROM_OID_PRE . zen_draw_input_field('from_oid', $limits['orders_id'][0], 'size="10"') . '</div>';
      echo '<div class="oidInput">' . OEX_TO_OID_PRE . zen_draw_input_field('to_oid', $limits['orders_id'][1], 'size="10"') . '</div>';
      echo '<div class="oidSubmit">' . zen_image_submit('button_save.gif', IMAGE_SAVE) . '</div>';//form submit
      echo '</form>';?>
    </div>

I have seen in the code these two variables defined and occasionally setup to be added to the uri, but in this case it comes down to an improperly formulated form creating at least in 1.5.x... Assuming you wanted to use a get style form:

      <?php echo zen_draw_form('oid_range', FILENAME_ORDERSEXPORT, '', 'get');
 

Should be:

      <?php echo zen_draw_form('oid_range', FILENAME_ORDERSEXPORT, 'get');
 

Removing the extra pair of single quotes and shifting the lineup of the get to the left for the call to zen_draw_form.

Now if there was some parameter that you wanted to pass on, then global variable $parameters would address those that were passed to the page (I think) otherwise you could go and collect the parameters from a function similar to zen_get_params (I forget what it's real name is).

28 Aug 2014, 11:34 AM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Odd extra elements in URL after form submission

gjh42:

...When selecting an export range, two odd elements are added to the URL in the address bar. They vary seemingly at random in the numbers, but always look like ...&x=23&y=9.
That's the position of the cursor when the "Save" button was pressed, coming from the submit-type button. I'm not sure if there is a way to prevent their insertion.

28 Aug 2014, 1:15 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Odd extra elements in URL after form submission

Other than visually annoying, what is the effect of those values being in the uri? Thought there might be a way to sanitize the string after being transferred to the destination? (Ie, if for some reason testing if $_GET is set, would want to not have those two in the list. Guess could test if they are in there, and then remove them if necessary for code processing, but guess trying to understand what the problem is being there.

28 Aug 2014, 2:39 PM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Odd extra elements in URL after form submission

As far as I know it's just a visual annoyance. It did look like a page location, and I wondered if it was related to the submit image. On examination, it is definitely the cursor position relative to the top left of the submit image.

Removing the extra pair of single quotes and shifting the lineup of the get to the left for the call to zen_draw_form. That caused the submit to malfunction and simply put "get" in the URL. The format of the form call was taken from others in stock ZC code, as was the image submit button.

I believe "zen_get_all_get_params()" is the function you were thinking of.

28 Aug 2014, 3:40 PM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Odd extra elements in URL after form submission

gjh42:

As far as I know it's just a visual annoyance. It did look like a page location, and I wondered if it was related to the submit image. On examination, it is definitely the cursor position relative to the top left of the submit image.
That caused the submit to malfunction and simply put "get" in the URL. The format of the form call was taken from others in stock ZC code, as was the image submit button.

I believe "zen_get_all_get_params()" is the function you were thinking of.

My response was provided from review of the zen_draw_form function as provided for ZC 1.5.0 at http://www.zen-cart.com/docs/phpdoc-1-5-0/functions/_includes---functions---html_output.php.html#functionzen_draw_form

Either the function has since been modified or was not updated there... Sorry...