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]
Sun 28/03/10 at 14:49
Moderator
"Are you sure?"
Posts: 5,000
Thanks Garin.
I'm hoping you're still waking up... :¬)


That's giving me: "No results for Array." at the moment.
www.hmmm.ip3.co.uk/searchtesting/garin.php







[s]Hmmm...[/s]
Sun 28/03/10 at 14:41
Regular
Posts: 19,415
Hope it works for you Hmmm.

I only just started learning PHP and MySQL. It's quite enjoyable, but I think I need Garin or Eccles to explain Bitwise operations for me.
Sun 28/03/10 at 14:31
Regular
"Devil in disguise"
Posts: 3,151
Change the check box names to keyword[ ] as you already tried and after the line

$keyword = $_POST['keyword'];

put..

if (is_array($keyword)) {
$keyword=implode(' ',$keyword);
}

I only just woke up so thats looks right but it might not be. :p
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]

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Great services and friendly support
I have been a subscriber to your service for more than 9 yrs. I have got at least 12 other people to sign up to Freeola. This is due to the great services offered and the responsive friendly support.
Top-notch internet service
Excellent internet service and customer service. Top-notch in replying to my comments.
Duncan

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.