This topic is locked

Using DB Field for Redirection (search)

4/25/2009 4:39:50 AM
PHPRunner General questions
S
snowman author

Hello,
I tried to find a solution for my problem, but didn't find, what i need, so hopefully anyone have an answer.
I have in the Main Form the Standard SEARCH Box and a list of projects.

So when i go to the project view, i can see the employees included in the selected project.
Now I just want to click the employees names (eg: thomas big) and will do a search on the main page (any field includes) thomas big.
I tried:

if(postvalue("EMPLOYEE")!="EMPLOYEE")

{

$value = "<a href=MAIN_list.php?a=search&value=1&SearchFor=$value.>".$value."</a>";

}
But the problem is, that just the first part of the name is transfered to the search field > and it found no records.

When i'm clicking again on search button, a result is shown, but just with "Thomas" <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=11648&image=1&table=forumtopics' class='bbc_emoticon' alt=':(' />

The link at the end looks:

http://mydomain.de/TEST/MAIN_list.php?a=se...earchFor=Thomas
Does anyone have an idea how to do it ??

J
Jane 4/27/2009

Hi,
I suppose you've added this code on the "View as" settings dialog on the Visual Editor tab.

All other field values are in the $data array, I.e.

$value = "<a href=MAIN_list.php?a=search&value=1&SearchFor=".$value." ".$data["Fieldname"].">".$value." ".$data["Fieldname"]."</a>";

S
snowman author 4/28/2009

Hi,

I suppose you've added this code on the "View as" settings dialog on the Visual Editor tab.

All other field values are in the $data array, I.e.


Hello Jane, thanks for your answer, but it didn't help right now.

You are fully right, i have a standard text field in the VIEW Page and entered in the View as Settings under "Custom" the following:
if(postvalue("EMPLOYEE1")!="EMPLOYEE1")

{

$value = "<a href=1_MAIN_list.php?a=search&value=1&SearchFor=".$value." ".$data["EMPLOYEE1"].">".$value."</a>";

}
So the problem are 2 in real:

  1. in the Field is the fullname of the employee (e.g. Bill Mayer), so when you klick on the name(link), it cuts the name on the blank between the names.

    so the link (name) isnt fully extracted: 1_MAIN_list.php?a=search&value=1&SearchFor=Bill (should be Bill%20Mayer or better Bill+Mayer in the link)
  2. it found no database entry's because the link isn't compete, it should be in real:

    1_MAIN_list.php?a=search&value=1&SearchFor=Bill%20Mayer&SearchOption=Contains&SearchField=
    I tried everything to put also the rest of the link in the code above, but with no success.
    So I also tried under view_as the hyperlink option:

    Display Field Content = Employee1

    URL Prefix = 1_MAIN_list.php?a=search&value=1&SearchFor=
    So the output here is the full name in the search field (Bill Mayer) > great, here the full field is selected from database, no cut.

    The hyperlink looks here: 1_MAIN_list.php?a=search&value=1&SearchFor=Bill%20Mayer (the %20 is no problem during a search in the hyperlink, but:)

    Here the same Problem, it found no records because the rest of the link is not addable after the selected field, if I add the rest in the hyperlink manually in the Addressfield it works perfect.

    1_MAIN_list.php?a=search&value=1&SearchFor=Bill%20Mayer&SearchOption=Contains&SearchField= >> works perfect
    I have just one big table including on the LISTVIEW just the Projectname and a few details (but not employees).

    Now then I select one project to see it in the VIEW all Projectdetails and also all employees, involved in the selected project.

    Now I want to click the Employees name in the View and fulfill a search on the Main_List_Page with the Name of Employee, to find out all project, wheter the employee is included or not.(Employees Fields are included in the search but not shown on the Listview.)
    So with that possibility it would be easy to slide trough the projects and details by just clicking links from the Employee Fields to the included project, than all project where the projectmanager is involved ...

    It would be cool feature for the view_as hyperlink option to have an extra field > use as simple_search, and the programm creates: <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=40578&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

    URL Prefix = 1_MAIN_list.php?a=search&value=1&SearchFor=

    DATABASE Field = [DATABASE FIELD] > select DBField (Dropdown)

    SELECT SEARCH OPTIONS > &SearchOption=Contains&SearchField=
    So at the end it should be shown on the page as allready selectable in the Field (show as Word "Link", Show DataField...) with a Hyperlink behind looks like that:

    1_MAIN_list.php?a=search&value=1&SearchFor=[DATABASE FIELD]&SearchOption=Contains&SearchField=
    So do you have an idea how i can add the "&SearchOption=Contains&SearchField=" at the end of the script???

    Sorry for the long text, but I think this would be great function in your great programm.

    Thanks in advance.

J
Jane 4/29/2009

Hi,
try to use this one:

global $data;

$value = "<a href=1_MAIN_list.php?a=search&value=1&SearchFor=".$value." ".$data["EMPLOYEE1"].">".$value."</a>";

S
snowman author 4/29/2009

Hello Jane,
thanks for your response, but the result is the same.

The Name is cutted in the hyperlink and also in the search field, and it found no records because the search link isn't complete.. (they actually are set to any field including, but the parameters are missed in the hyperlink)
Any other suggestions???
To become an idea what I tried to to see: http://www.imdb.com

They have also a database behind there site and most of the data are links.

I just try the same but do not link to another site > just do a simple search on Main Page.
Thanks for any help, I appreciate it.

Regards

S
snowman author 4/29/2009

Hello again,
for information:
when I use in the view_as section the hyperlink >> the full name is readout from field "EMPLOYEE1" (Bill Mayer will be Bill Mayer than in the search field itself and in the hyperlink)
when I do it with Custom Code, and your code, the Employee1 Name will be cutted after the First Name (Bill Mayer will be then just Bill)
In both cases the search criteria on the main page are autoset to any field includes, but in the hyperlink, the parameters are missing >> therefore "no matches found"

If I click again just the search button (the name is filled as described above) the hyperlink will be extended with the paramters for type and field >> and the matches are shown correctly.
Regards

Snowman

J
Jane 4/30/2009

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
snowman author 5/3/2009

Hello Jane,
I figure it out for myself, it looks like that the search function is not always working when you just send the searchfor text, but no other parameters.
I've done it in the code with that, I replaced the normal datafield by that:
<A href="1_MAIN_list.php?a=search&amp;value=1&amp;SearchFor={$EMPLOYEE1_value}&amp;SearchOption=Contains&amp;SearchField=">{$EMPLOYEE1_value}</A>

So with that every Employee will be shown with the full name and the linking is also working very well.
But still the question will be, why it doesn't work as you mentioned.

$value = "<a href=1_MAIN_list.php?a=search&value=1&SearchFor=".$value." ".$data["EMPLOYEE1"].">".$value."</a>";

With that, the Name is cutted from Bill Mayer to just Bill...
But thanks for your inputs.

Snowman

J
Jane 5/4/2009

Hi,
try to use this one:

$value = "<a href=1_MAIN_list.php?a=search&value=1&SearchOption=Contains&SearchField=EMPLOYEE1&SearchFor=".$value.">".$value."</a>";

S
snowman author 5/5/2009

Hello Jane,
thanks again for input, I tried your code:

$value = "<a href=1_MAIN_list.php?a=search&value=1&SearchOption=Contains&SearchField=EMPLOYEE1&SearchFor=".$value.">".$value."</a>";

So with that, now it found some records, but in the search field and the hyperlink, the name leaves cutted after the first name, but in the view window, the name is shown fully.
I changed the field then to view_as hyperlink and use as URL Prefix:

1_MAIN_list.php?a=search&value=1&SearchOption=Contains&SearchField=EMPLOYEE1&SearchFor=
With that it works correctly, the name is then in the search field and the hyperlink too.
I'm happy with that...

Best Regards Snowman