Problem with $_POST data

QuestionsProblem with $_POST data
Lacroix Alexis asked 5 years ago

Hello,

I'm using PHP GRID CONTROL on a webpage. On this webpage I can change a parameter to filter the datas in the table. I'm using a POST form which calls back the same webpage. She retrieve the POST data and she's uses it in the $g->select_command.
But the table don't take care of this new data. It's the same result as before I changed the parameter …

How I retrieve the POST data :

if ((isset($_POST['site'])) && (!empty($_POST['site']))) {
$_SESSION['site'] = $_POST['site'];
}
$site = $_SESSION['site'];

My SQL command : $g->select_command = "SELECT s.`ref`,s.`quantite`,s.`rupture` FROM `stock` s LEFT JOIN `produits` p ON s.`ref`= p.`ref` WHERE s.`date` ='".$date."' AND p.`site` = '".$site."'";

(It works for $date because I'm searching this data in the SQL database)

PS : I looked the FAQ, question : How to load grid based on $_POST data from other page?
But it doesn't works…

Where should we write the code given in the FAQ ? Before the include("phpgrid-free-v1.5.2/lib/inc/jqgrid_dist.php"); ??

Best Regards,
Alexis

4 Answers
Lacroix Alexis answered 5 years ago

EDIT : It's working now but when I'm leaving the webpage and if I'm coming back it keeps the last data from $site.
So I tried to add : else { $_SESSION['site'] = "EBC"; }
to make that when we come back $site = "EBC" but in this case the table show only when $site = "EBC" not the other possibility …

Abu Ghufran answered 5 years ago

1) Yes, conditional formatting is part of licensed version
2) You can put select_command (sql) and add WHERE condition to show only rows that have column value != 0.

Lacroix Alexis answered 5 years ago

REEDIT : Sorry for triple post…
I've change the method, I use 2 links which uses GET method. It's working now.

But the research of the table don't works now … :/
I have this error :
Couldn't execute query. Column 'ref' in where clause is ambiguous – SELECT count(*) as c FROM (SELECT s.`ref`,s.`quantite`,s.`rupture` FROM `stock` s LEFT JOIN `produits` p ON s.`ref`= p.`ref` WHERE s.`date` ='2014-12-09' AND p.`site` = 'EBC' AND ref LIKE '%2874%') pg_tmp

What is the problem ?

Lacroix Alexis answered 5 years ago

REREEDIT : I've solved this problem, but now I would like give a css property to a row. For this we should use "Conditionnal Formating", I tried but i've a blank page… "Conditionnal Formating" is working with free version ?
Second question : Could we do a condition for the row display ? Per example if the value of a column from this row is equal to 0, the grid shouldn't display this row.

Thanks for responses 🙂

Your Answer

2 + 19 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!