Building a Search Query to External Site

I'm building out a form on my Drupal PHP page with the action set to go to "All for Good".

1) Here is the URL string that works on the "All For Good" site, searching for "education"

2) Here is my code on the action parameter. Needless to say, it's not working. I sense I'm missing something obvious.

action="" target="_blank" name="Form1">
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris SandriniSenior System EngineerCommented:

Just from looking at it I can see few differencies

q=value is in your second example but first it is q=education
also it is not ?q=education but #q=education with a hash!
sandshakimiAuthor Commented:
I showed the first example because that's the one that works.

Using the hash didn't do anything.
Chris SandriniSenior System EngineerCommented:
it does here. show me your link with the hash
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

sandshakimiAuthor Commented:
I mean...

Replacing "question" with "hash" in my action URL didn't do anything.
Chris SandriniSenior System EngineerCommented:
show me the url
sandshakimiAuthor Commented:

Even with putting "hash", it's being auto replaced by a "question" mark.

I was thinking use urlencode or something like that?
Chris SandriniSenior System EngineerCommented:
The problem is that when you submit your form it will automagically create the URL using a questionmark. You can only change that using Javascript or you go though a PHP script first before you redirect it to the website.

The URL should be
sandshakimiAuthor Commented:
Well, since I'm on Drupal, what's the PHP snippet for that?

Or is it easier with JavaScript?
Chris SandriniSenior System EngineerCommented:
maybe like this :)

$url = "#";
$first = true;
foreach($_GET as $key => $value)
		$url.= "&";
	} else
		$first = false;
	$url .= $key."=".$value;

Open in new window

sandshakimiAuthor Commented:
I see you're creating some variables, what is the code doing? And where on the page should I plug it in?
Chris SandriniSenior System EngineerCommented:
basically you have a form with input fields right? Set the action to the php file i provided you. like

<form action="route.php" method="get>
<input type="text" name="q" value="">
<input type="text" name="num" value="">

Open in new window

When you submit this form it will create an url called

route.php?q=value&num=value ......

route.php will then get the values and change its format and automatically redirect you to allforgood

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sandshakimiAuthor Commented:


If you're able, I hope you can investigate a new question:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Content Management

From novice to tech pro — start learning today.