GetDotted Domains

Viewing Thread:
"Calling PHP geeks! Help required with php search script"

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.

Sun 28/03/10 at 13:26
Moderator
"Are you sure?"
Posts: 5,000
I know a few of you speak 'php' as your first language(!) so hopefully you'll be able to help a 'cut-n-paster' :¬)


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]
Wed 31/03/10 at 11:58
Regular
"Embrace the Martian"
Posts: 285
You can blame, stripslashes(). But I'll look into this sometime this week, well I suppose that means either today or tomorrow.

EDIT: I guess I will have to look at this when I get back off holiday, been fairly busy!
Wed 31/03/10 at 11:55
Staff Moderator
"Freeola Ltd"
Posts: 3,299
I know, it's just my way of wording things :) Gets a lot worse when I'm occupied :D
Wed 31/03/10 at 11:33
Moderator
"Are you sure?"
Posts: 5,000
Warhunt wrote:
> 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]
Wed 31/03/10 at 11:26
Staff Moderator
"Freeola Ltd"
Posts: 3,299
Ahhhh, now I see. Very early and issues with BT keeping my mind elsewhere :D

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
Wed 31/03/10 at 10:42
Moderator
"Are you sure?"
Posts: 5,000
Warhunt wrote:
> 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]
Wed 31/03/10 at 10:35
Staff Moderator
"Freeola Ltd"
Posts: 3,299
I didn't think he had typed two. It's early, forgive me :S
Wed 31/03/10 at 10:17
Moderator
"Are you sure?"
Posts: 5,000
Warhunt wrote:
> Shouldn't have stripped it out. Wonder why it did :S

It's always done it!

Typing two backslashes = 1 \








[s]Hmmm...[/s]
Wed 31/03/10 at 10:07
Staff Moderator
"Freeola Ltd"
Posts: 3,299
Shouldn't have stripped it out. Wonder why it did :S

I'll take a look.
Wed 31/03/10 at 08:54
Moderator
"Are you sure?"
Posts: 5,000
Thanks Garin - that all works a treat! :¬)












[s]Hmmm...[/s]
Tue 30/03/10 at 20:04
Regular
"Devil in disguise"
Posts: 3,151
Ah, the forums have stripped out a crucial character. This line

$keyword = preg_replace('/[^a-zA-Z0-9s]/', '', $keyword);

should have a backslash before the s.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

First Class!
I feel that your service on this occasion was absolutely first class - a model of excellence. After this, I hope to stay with Freeola for a long time!
Everybody thinks I am an IT genius...
Nothing but admiration. I have been complimented on the church site that I manage through you and everybody thinks I am an IT genius. Your support is unquestionably outstanding.
Brian

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.