This topic is locked
[SOLVED]

 custom process selected records

11/2/2009 12:29:38 PM
PHPRunner General questions
S
sameveritt author

Good Morning -
I figured this out earlier this year. Now, that I need to re-create it - I don't know what I did.
I've placed a button 'Display Template' up by the 'Add New' and 'Delete Selected' buttons.
I want to select one record, click the button, and pass the variables to another script.
I had it where it would run a script: 'process_template.php?template=1&attribute=3".
But now, I don't know where to put the snippet, I'm not sure if the snippet should just redirect to the script - I think I did something different before.
Any help would be appreciated.
Thanks,
Sam
____

Okay, I did find another method that kinda works:
<input type=button value=button1 onclick="window.location.href='tablename.php?parameter={$FieldName_value}';">
instead of the original method:

<INPUT class=button onclick="frmAdmin.a.value='template'; frmAdmin.submit(); return false;" value="Display Template" type=button>
I can't figure out the original snippet to go with the second method. I remember testing to make sure it passed the value 'template', then did something to call 'process_template.php' with the variables. Just can't remember how I accomplished it.
___

I've got:
<INPUT class=button onclick="frmAdmin.a.value='template'; frmAdmin.submit(); return false;" value="Display Template" type=button>
in the html to create a button on the main screen
then in the events - List Page: Before Process - I have:
if(@$_REQUEST["a"]=="template")
if(@$_REQUEST["selection"])

{

foreach(@$_REQUEST["selection"] as $keyblock)

{

$arr=split("&",refine($keyblock));

$keys=array();

$keys["email_id"]=urldecode(@$arr[0]);

$where = KeyWhere($keys);
$rs = CustomQuery("select * from email_control where $where");

$data=db_fetch_array($rs);
$template = $data['email_template'];

$attribute = $data['email_attribute'];
header("Location: process_template.php?template=$template&attribute=$attribute");
But I'm still not getting it to work!
When I click the button (and force it to change from Post to Get) it returns:
email_control_list.php?a=template&selection[]=11
so it's passing the template and the correct id for the selection, but it's returning to email_control_list.php not process_template.php
I'll look some more - and hey, thanks for everybody's assistance.

J
Jane 11/3/2009

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

S
sameveritt author 11/3/2009

Hello Jane - thanks for your answer
I may have made this look more difficult than it has to be.
I just want two things

  1. a button at the top of the page.

    This is done
  2. I want the values from the selected row to be passed to a custom script after clicking the button.
    I can click the button and see that the variables are passed back to email_control_list:

    "email_control_list.php?a=template&selection[]=10"
    but I thought if my custom snippet was in 'List Before Processing' it would execute as it went back to email_control_list.
    That snippet in 'List Before Processing' is shown previously.
    It tests for a=template, then tests if selection's been set. If so it strips the data from the selection, queries a DB using that data, then redirects to the processing script.
    It's pretty clear cut stuff. It should work.
    My main question is: Is 'List Before Processing' the correct location for the snippet?

    otherwise, do you see anything wrong with the snippet, the redirection?
    Thanks for your help
    Sam

J
Jane 11/4/2009

Hi,
check BeforeDelete event for this purpose:

http://www.xlinesoft.com/phprunner/docs/before_record_deleted.htm

S
sameveritt author 11/9/2009

Hello -
Just to let you know.
I tried the BeforeDelete, it didn't make sense to me to put the snippet there, but I tried it.
Didn't work.
I deleted everything from my server and quickly rebuilt the project.
I put in the code, as mentioned above, and everything worked as it was supposed to.
It passed the selected row to my custom processing script, simple, just what I wanted.
Cleaned everything out and started anew. Solved all the problems.
Thanks - wonderful program
Sam