How do I identify the nth position of an inputted keywords (including numbers) through a n html search form?

Eg: keyword1 keyword2 keyword3

position of keyword1 = 1
position of keyword2 = 2
position of keyword3 = 3

And then use that nth keyword to query a particular field in mysql tables.

Thanks!

Member Avatar for diafol

Yep, arrays. Here a hint:

explode using a space as a delimiter
apply the 'key + 1' as the position for a value. This is because array keys start at 0 by default.

Thanks. Sorry for the late response. I could solve the problem with explode() and then using count() and list().

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.