Value in a grid

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi! I've a grid with a button that allow to pass value to another
page.... My problem is that I don't like to pass these value on the
page because users could change/modify them... can you help me to find
a solution?

foreach ($wscalls as $key=>$wscall)
               $iddocumento =   $wscall['iddocumento'] ;

               $actions = "<a href = ' ' onclick= ' return
sendemail(\"" . (string)$iddocumento . "\"); ' > <img src= '" .
$this->view->baseUrl() . "/css/images/sendemail.png ' />  </a> ";

                   if ((isset($iddocumento) && !empty($iddocumento))
&& ((int)$value>0 )){
                        $actions .= "<a href = 'pay?value=" .
$value . "&iddocumento=". $iddocumento . "' $onclick  > <img src=
'" . $this->view->baseUrl() . "/css/images/". $img_pay ." ' />  </a>


How can I pass value to send page without show user the values??


Re: Value in a grid

El 30/12/2010 11:48, Sarah escribió/wrote:
Quoted text here. Click to load it

I don't think there's a PHP solution to that because PHP runs on the
server. You should improve your client-side JavaScript to pick the value
and send it to the server (as a GET parameter, in a POST form, with an
AJAX request... whatever you prefer). One you manage to do so, you can
fetch the value from $_GET or $_POST (depending on the method you chose).

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor satinado:

Re: Value in a grid

On 30/12/10 10:56, "=C1lvaro G. Vicario" wrote:
Quoted text here. Click to load it

Perhaps the answer is to use php sessions rather than passing values
using hidden values in forms.


Denis McMahon

Re: Value in a grid

Sarah wrote:

Quoted text here. Click to load it


(Never ask yes-or-no questions unless you expect the answer to be "Yes" or
"No."  But see below.)
Quoted text here. Click to load it

What about users without client-side script support?
Quoted text here. Click to load it

This should be rewritten at least as

  foreach ($wscalls as $key => $wscall)
    $iddocumento = $wscall['iddocumento'];
    $baseURL = $this->view->baseUrl();

    $actions = '<a href=""'
             . ' onclick="return sendemail('' . $iddocumento . '')">'
             . '<img src="' . $baseURL . '/css/images/sendemail.png" />'
             . '</a> ';
    if (isset($iddocumento) && !empty($iddocumento) && ($value > 0))
      $actions .= '<a href="pay?value=' . rawurlencode($value)
               .  '&amp;iddocumento=' . $iddocumento . "\" $onclick>"
               .  '<img src="' . $baseURL . '/css/images/'
               .  rawurlencode($img_pay) . "\" /></a>\n";

    // …

Here's why:

 1. Use proper indentation, keep your code style consistent and easily
    readable.  Best is to adopt one of the prevalent code styles (such as
    the PEAR Code Style), and adapt it to your needs (unless you want to
    write a PEAR module).
 2. Remove unnecessary whitespace.
 3. Avoid escaping by using different string delimiters, making the code
    easier readable.
 4. Make markup code easily movable from static to dynamic generation;
    i.e. prefer apostrophes to delimit strings of generated markup, so that
    you can continue using the customary quotes for attribute delimiters.
 5. Do not put spaces around the `=' in markup, this dissolves visually the
    connection between attribute name and value and can easily lead to
    parse errors.
 6. Explicit typecast to string is unnecessary in (*string*) concatenation.
 7. Do not put spaces after the start tag or before the end tag of an
    (inline) element, see
    < .
 8. For generating markup, encode all values that are not already encoded
    (here: rawurlencode()).
 9. For interoperability, there should not be more than 80 characters in
    a line of code; use concatenation as necessary.
10. Explicit typecast to int is unnecessary with the `>' operator.
11. Remove unnecessary parentheses to improve readability.
12. If a method always returns the same value, do not call it more than
    once.  Store the return value in a variable once and use the variable
    value instead.

You might also want to consider using less concatenation and a more
template-based approach (inline references, HereDoc) instead.
Quoted text here. Click to load it

Store sensitive data in a session, or use a POST form to hide the values
from the more casual (and less programming-savvy) observer.


Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.

Re: Value in a grid

Thomas 'PointedEars' Lahn wrote:

Quoted text here. Click to load it

Sorry, I meant

    $baseURL = $this->view->baseUrl();

    foreach ($wscalls as $key => $wscall)
      $iddocumento = $wscall['iddocumento'];

      // …

Quoted text here. Click to load it

Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

Re: Value in a grid

Excuse me but I don't know what exactly I've to do....

another thig: using


I can't view my var encryped ... but has the same values

Re: Value in a grid

Sarah wrote:

Quoted text here. Click to load it

Read my posting from top to bottom, and try to follow the advice given
therein.  Ask *specific* and *coherent* *questions* in case something is
still unclear: <

And < .

Quoted text here. Click to load it

You are not making any sense.

var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
)  // Plone, register_function.js:16

Site Timeline