Jump to content

Sending Array to php file for processing


iggi

Recommended Posts

I'm having some trouble sending an array that exists in the clientarea.tpl file of my server provisioning module to my php file for processing.

 

What I am trying to do is get the multidemensional array that is {$configurableoptions} and send it to the php file when a user clicks a button, then they are sent to a new page with the processed data.

 

For right now we have clientarea.tpl with the following content:

 

<form method="post" action="clientarea.php?action=productdetails">
<input type="hidden" name="id" value="{$serviceid}"/>
<input type="hidden" name="clientstatus" value="{$clientsdetails.status}"/>
<input type="hidden" name="overdueinvoicebalance" value="{$clientstats.overdueinvoicesbalance}"/>
<input type="hidden" name="packagestatus" value="{$status}"/>
<input type="hidden" name="configoptions" value="{$configurableoptions|@serialize|@htmlspecialchars}"/>
<input type="hidden" name="modop" value="custom"/>
<input type="hidden" name="a" value="clientmanagepage"/>
<input type="submit" value="Manage Your Server"/>
</form>

 

Which invokes the function epicmgr_clientmanagepage:

function epicmgr_clientmanagepage($params){
$configoptions_decoded = htmlspecialchars_decode($configoptions);
$options = unserialize($configoptions_decoded);
$pagearray = array(
	'templatefile' => 'client_manage',
	'breadcrumb' => ' > <a href="#">Manage Server</a>',
	'vars' => array(
	'testvariable' => $options,
	),
);
return $pagearray;
}

 

I've done this by first serializing and encoding the html special characters, which seems to work fine at shows up in the client area as having a value which is the serialized and encoded version of the array (as seen below). However, the PHP file seems to get fed a blank variable and I have no idea why.

 

<form method="post" action="clientarea.php?action=productdetails">
<input type="hidden" name="id" value="1"/>
<input type="hidden" name="clientstatus" value="Active"/>
<input type="hidden" name="overdueinvoicebalance" value=""/>
<input type="hidden" name="packagestatus" value="Active"/>
<input type="hidden" name="configoptions" value="a:3:{i:0;a:13:{s:2:"id";s:1:"1";s:6:"hidden";s:1:"0";s:10:"optionname";s:9:"Bandwidth";s:10:"optiontype";s:1:"1";s:13:"selectedvalue";s:1:"1";s:11:"selectedqty";i:0;s:12:"selectedname";s:6:"1000GB";s:14:"selectedoption";s:6:"1000GB";s:13:"selectedsetup";s:4:"0.00";s:17:"selectedrecurring";s:4:"0.00";s:10:"qtyminimum";s:1:"0";s:10:"qtymaximum";s:1:"0";s:7:"options";a:4:{i:0;a:5:{s:2:"id";s:1:"1";s:4:"name";s:6:"1000GB";s:8:"nameonly";s:6:"1000GB";s:9:"recurring";s:4:"0.00";s:6:"hidden";s:1:"0";}i:1;a:5:{s:2:"id";s:1:"2";s:4:"name";s:14:"2000GB $10.00 ";s:8:"nameonly";s:6:"2000GB";s:9:"recurring";s:5:"10.00";s:6:"hidden";s:1:"0";}i:2;a:5:{s:2:"id";s:1:"3";s:4:"name";s:15:"3000 GB $20.00 ";s:8:"nameonly";s:7:"3000 GB";s:9:"recurring";s:5:"20.00";s:6:"hidden";s:1:"0";}i:3;a:5:{s:2:"id";s:1:"4";s:4:"name";s:14:"4000gb $30.00 ";s:8:"nameonly";s:6:"4000gb";s:9:"recurring";s:5:"30.00";s:6:"hidden";s:1:"0";}}}i:1;a:13:{s:2:"id";s:1:"4";s:6:"hidden";s:1:"0";s:10:"optionname";s:16:"Operating System";s:10:"optiontype";s:1:"1";s:13:"selectedvalue";s:1:"9";s:11:"selectedqty";i:0;s:12:"selectedname";s:7:"Windows";s:14:"selectedoption";s:7:"Windows";s:13:"selectedsetup";s:4:"0.00";s:17:"selectedrecurring";s:4:"0.00";s:10:"qtyminimum";s:1:"0";s:10:"qtymaximum";s:1:"0";s:7:"options";a:2:{i:0;a:5:{s:2:"id";s:1:"9";s:4:"name";s:7:"Windows";s:8:"nameonly";s:7:"Windows";s:9:"recurring";s:4:"0.00";s:6:"hidden";s:1:"0";}i:1;a:5:{s:2:"id";s:2:"10";s:4:"name";s:5:"Linux";s:8:"nameonly";s:5:"Linux";s:9:"recurring";s:4:"0.00";s:6:"hidden";s:1:"0";}}}i:2;a:13:{s:2:"id";s:1:"6";s:6:"hidden";s:1:"0";s:10:"optionname";s:10:"FTP Backup";s:10:"optiontype";s:1:"1";s:13:"selectedvalue";s:2:"13";s:11:"selectedqty";i:0;s:12:"selectedname";s:4:"10GB";s:14:"selectedoption";s:11:"10GB $5.00 ";s:13:"selectedsetup";s:4:"0.00";s:17:"selectedrecurring";s:4:"5.00";s:10:"qtyminimum";s:1:"0";s:10:"qtymaximum";s:1:"0";s:7:"options";a:2:{i:0;a:5:{s:2:"id";s:2:"13";s:4:"name";s:11:"10GB $5.00 ";s:8:"nameonly";s:4:"10GB";s:9:"recurring";s:4:"5.00";s:6:"hidden";s:1:"0";}i:1;a:5:{s:2:"id";s:2:"14";s:4:"name";s:13:"100GB $10.00 ";s:8:"nameonly";s:5:"100GB";s:9:"recurring";s:5:"10.00";s:6:"hidden";s:1:"0";}}}}"/>
<input type="hidden" name="modop" value="custom"/>
<input type="hidden" name="a" value="clientmanagepage"/>
<input type="submit" value="Manage Your Server"/>
</form>

Link to comment
Share on other sites

I replaced $configoptions with $params['configoptions']; and it's still not pulling that line through. No matter if I send it as a long string or as the array structure itself, I just get $params['configoptions'] with an empty array in it. (when I do a print_r on $params I get "[configoptions] => Array ( )")

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated