The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
I have a basic php flatfile search script that I'm trying to modify.
The script works fine for visitors using a free form search but I would like to add some form checkboxes to make it friendlier.
The script uses a variable called 'keyword'.
The freeform search passes single or multiple search terms successfully but the FORM i'm attempting to use with checkboxes only makes use of the last selection.
The form I've created uses duplicate names - 'keyword'
<input type="checkbox" name="keyword"
value="hosting"
<input type="checkbox" name="keyword" value="broadband">broadband
In my ham fisted way I've read that I can change this to
"keyword[ ]"
and this should create an array. When I try this the script ends up searching for Array ! You can see the problem/code here:
www.hmmm.ip3.co.uk/searchtesting
Using FORM 1 searching for 'hosting broadband' only returns Freeola in the results.
Using FORM 2 selecting both hosting and broadband the script only searches for broadband - only picking up the last keyword.
Any help changing the FORM and/or script would be appreciated :¬)
Thanks.
[s]Hmmm...[/s]
EDIT: I guess I will have to look at this when I get back off holiday, been fairly busy!
> That will be because of lovely PHP. I'll see if we can sort it
> out today. Not urgent I imagine but if it bugs people..... :D
It's not really a matter of it 'bugging' people - it ruins people's code! :¬P
It's been raised in the past - but it would be great if it could be sorted.
[s]Hmmm...[/s]
That will be because of lovely PHP. I'll see if we can sort it out today. Not urgent I imagine but if it bugs people..... :D
> I didn't think he had typed two. It's early, forgive me :S
He didn't ;¬)
If you just type one backslash (here's one:) then the forum strips it. To get one to display you have to type two! (here's two:\)
[s]Hmmm...[/s]
> Shouldn't have stripped it out. Wonder why it did :S
It's always done it!
Typing two backslashes = 1 \
[s]Hmmm...[/s]
I'll take a look.
$keyword = preg_replace('/[^a-zA-Z0-9s]/', '', $keyword);
should have a backslash before the s.