Welcome Guest, Not a member yet? Register   Sign In
Interrelational results in several pages
#1

[eluser]agartzia[/eluser]
Hi!

I'm coding a large application that uses several tables with all the information interrelated. From a table I take several values, and some of them can point to another table. For example, the table USERS has a field like "range" where it's set the range id. With this id I can check out the table RANGES and find out what the user can and can not do.

This is all set in several pages (users.php, ranges.php...). All pages have their own search methods. I used to link the range value to the ranges.php page, so anyone could click the link and look at the result in the ranges.php page, like this
Code:
<a href="ranges.php?search[id_range]=&lt;?=$data['range'];?&gt;">&lt;?=$data['range'];?&gt;</a>
where the search values were taken from GET values.

Now I'm using CI and I'm trying to make some similar, but GET is disabled and I would like to keep it that way.

How can I manage to inter-relationate pages with simple links?

Thanks!
#2

[eluser]xwero[/eluser]
Code:
<a href="&lt;?php echo site_url('ranges/search[id_range]/'.$data['range']); ?&gt;">&lt;?=$data['range'];?&gt;</a>
#3

[eluser]agartzia[/eluser]
Is there a way not to code another function? Just want to make a search, but with no form submitting, just from page to page.
#4

[eluser]xwero[/eluser]
the site_url function just builds an absolute url.
#5

[eluser]agartzia[/eluser]
[quote author="xwero" date="1201617036"]the site_url function just builds an absolute url.[/quote]

Well, I know that. What I'm trying to mean is that solution doesn't fit, because

- I would need to code again the function "range" to take search values as a param (which I think is a wrong idea)
- Some security flaw...

What I need to do is submiting a search from another page, or another solution that may came up to accomplish it.

I've thought of javascript and redirecting, but it doesn't look very professional...
#6

[eluser]agartzia[/eluser]
I'll try to explain it further...

My search fields names are this easy: search[field]. So I only collect once $search and I got all the values in the array.

The problem goes when, instead of making a form-submit search, I try to make a search from a link.

Noone's a similar question?
#7

[eluser]xwero[/eluser]
you mean something like this, search field input "me myself and i" which generates links to search "me", "myself", "i"?
#8

[eluser]agartzia[/eluser]
Hi xwero.

Nop, an example search form:

Code:
&lt;?
$search = $_POST['search'];

// ... all search stuff ...

?&gt;
&lt;form action="search" methond="post"&gt;
ID: &lt;input type="text" name="search[id_user]" value="&lt;?=$search['id_user'];?&gt;" /&gt;
Name: &lt;input type="text" name="search[name_user]" value="&lt;?=$search['name_user'];?&gt;" /&gt;
Mail: &lt;input type="text" name="search[mail_user]" value="&lt;?=$search['mail_user'];?&gt;" /&gt;
&lt;input type="submit" value="Search!" /&gt;
&lt;/form&gt;

So you can search for any users in any way, this easy. If you want a user called Jimmy from a domain like @foo.com, you can submit a search like "Jimmy" and "@foo.com" in their respective fields.

BUT I need to use the search engine in order to show some users. For example, in a statics page I may show "There's 9 users from @foo.com" and I should be able to click and see all that 9 users.

Before starting with CI, I used to made a link to "users.php?search[mail_user]=foo.com" and it generated the search, showing the 9 users.

This example only uses one field, but I could be up to 15 fields.

Sorry for the long text!




Theme © iAndrew 2016 - Forum software by © MyBB