This topic is locked

CheckBox Suggestion?

9/15/2009 2:08:36 PM
PHPRunner General questions
D
dblack6047 author

Greetings,
I have instituted within my "Table Events" the below "if statement" which basically removes duplicates (via the column I call "MD5") from the Export Page.
What I would like to add is a simple CheckBox on the Export page that if checked would prevent the "Table Event" from occuring thus avoiding the duplicates from being removed/exported and regular (duplicate) data is Exported. Does anyone have any suggestions? I've looked around the forum for a day and cannot see anything like what I am needing.
I suspect that I would add an "and statement" onto the "if statement" based on the checkbox status being either selected or not. Any suggestions?
*CURRENT TABLE EVENT CODE BELOW**

if (substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1)=="search_engine_export.php")

{

$gsqlHead="SELECT Name, MD5, SHA_1, SHA_256";

$gsqlFrom="FROM search_engine ";

$gsqlWhereExpr="1 ";

$gsqlTail="GROUP BY MD5 ";

}

*
TABLE EVENT CODE ABOVE*****

Sergey Kornilov admin 9/15/2009
  1. Add something like this to the export form
    <input type="checkbox" name="check" id="check"/> Avoid duplicates
  2. In your event code use something like this:
    if ($_POST['check'] == "ON")

    {

    ...

    }

D
dblack6047 author 9/15/2009

Sergey,
I tried your suggestion by adding a CheckBox on the Export Page with the specific values you had listed plus I used the IF STATEMENT you suggested within the Table Event ("After Table Initialized") but the CheckBox does not seem to have any effect on allowing/disallowing duplicates from being exported. The code looks sound but something with the CheckBox method is just not engaging properly. I've even moved the code to all the other Table Events (i.e. Export Page:Before Process and Search Page:Before Process) and the CheckBox code to other pages (i.e. Search and List Page). Still it seems nothing is triggering the allow/disallow duplicate exports.
If I put my old IF STATEMENT Table Event code back it works fine but there is no way to turn on/off the Table Event code.
Is there one more suggestion that I might try?
*NEW TABLE EVENT CODE BELOW**

if ($_POST['check'] == "ON")

{

$gsqlHead="SELECT Name, MD5, SHA_1, SHA_256";

$gsqlFrom="FROM search_engine ";

$gsqlWhereExpr="1 ";

$gsqlTail="GROUP BY MD5 ";

}

*
NEW TABLE EVENT CODE ABOVE*****

J
Jane 9/16/2009

Hi,
try to use this code:

<INPUT id=check type=checkbox name=check onchange="if (document.getElementById('check').checked==true) {window.location.href='products_export.php?check=ON';"> Avoid duplicates
D
dblack6047 author 9/16/2009

Jane,
I think your recommendation had a missing curly bracket opposite "{window" so I added what I believe was missing (See directly below). Still, it did not trigger the Checkbox function when applied.
<INPUT id=check onchange="if (document.getElementById('check').checked==true) (window.location.href='search_engine_export.php)check=ON';" type=checkbox name=check> Avoid duplicates
I subsequently deduced to seeing if I could apply a simple IF STATEMENT using "Display a message on the Web Page" and using a Checkbox applied to either the Search page, List Page and Export Page. It appears that the IF STATEMENTS and CheckBox do not function together when involving Table Events and/or "After Table Initialized". Might this be an internal coding bug?
CHECKBOX CODE TEST #1: <input type="checkbox" name="check" id="check"/> Avoid duplicates
BEGIN TABLE EVENT - AFTER TABLE INITIALIZED

if ($_POST['check'] == "ON")

{

echo "Hello Message";

}

END TABLE EVENT - AFTER TABLE INITIALIZED

Sergey Kornilov admin 9/16/2009

I recommend to post your application to Demo Account (use 'Demo Account' button on the last screen in program). Then open a ticket at http://support.xlinesoft.com sending your Demo Account URL for investigation.

D
dblack6047 author 9/21/2009

All,
I opened a Ticket after posting my application to the Demo Account as requested by the PHPRunner admin. Jane was able to suggest a very minor code adjustment "$_REQUEST" which allowed my CheckBox code to work with my TABLE EVENT code. Everything worked. All we had to do was switch out the $_POST to $_REQUEST and then it worked. Thanks Jane!
-----------------------------

CheckBox code within the Export Page:

-----------------------------
<INPUT id=check type=checkbox name=check >
-----------------------------

and EVENT_INIT_TABLE event code:

-----------------------------

if ($_REQUEST['check'] == "on")

{

$gsqlHead="SELECT Name, MD5, SHA_1, SHA_256";

$gsqlFrom="FROM search_engine ";

$gsqlWhereExpr="1 ";

$gsqlTail="GROUP BY MD5 ";

}