/    Sign up×
Community /Pin to ProfileBookmark

Navigation system not working properly

Hello everyone,

I need some help with this. The following script and form does this. There is a text field in which when the user types spacific keyword predefined in the .php script he is taken to the appropriate link.

My problem is this. When the link is something like

[url]http://google.com,[/url] [url]http://mysite.com/page1.html,[/url] [url]http://something.com/mydirectory/page2.html,http://paypal.com[/url]

it works ok.

When the link is a paypal subscription link ie

[url]https://www.paypal.com/subscriptions/business=myemail%40mysite.com&item_name=subscription+no+1&item_number=S01&no_shipping=1&no_note=1&currency_code=USD&a3=45.00&p3=1&t3=Y&src=1&sra=1[/url]

it doesn’t work. It doesn’t take me to the predefined link.

Does anyone know why?

Here is the code.

Form:

<form method=post>
Keyword: <br>
<input type=text name=keyword>
<input type=hidden name=sub value=1>
<input type=submit value=Go!>

Here is the php

<?php
if($sub==1)
{
if($keyword==”google”)
{
echo(“<script>window.location=’http://google.com’;</script>”);
}
else if($keyword==”my site”)
{
echo(“<script>window.location=’http://mysite.com/samplepage.html’;</script>”);
}
else if($keyword==”paypal subscription 1″)
{
echo(“<script>window.location=https://www.paypal.com/subscriptions/business=myemail%40mysite.com&item_name=subscription+no+1&item_number=S01&no_shipping=1&no_note=1&currency_code=USD&a3=45.00&p3=1&t3=Y&src=1&sra=1′;</script>”);
}
else
{
echo(“That is not a valid keyword.”);
}
}
?>

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@shimonAug 18.2004 — It's probably the javascript ballsing it up. Might be best to use a pure PHP solution.

[code=php]<?php

if($sub==1){
if ($keyword=="google") {
header("Location: http://www.google.com/");
} elseif ($keyword=="my site") {
header("Location: http://mysite.com/samplepage.html");
} elseif ($keyword=="paypal subscription 1") {
header("Location: https://www.paypal.com/subscr...p3=1&t3=Y&src=1&sra=1");
} else {
echo("That is not a valid keyword.");
}
}

?>[/code]
Copy linkTweet thisAlerts:
@gwitasodauthorAug 18.2004 — Shimon,

that did it. thank you very much.

Do you know why javascript messed things up? Just so I know.

Thanx again.

G.
Copy linkTweet thisAlerts:
@shimonAug 19.2004 — Not specifically - but I would guess that the many & and + characters and a stray '; in the longer Paypal URL would be the cause.

Either way, it's nicer not to have to mix coding languages if you can avoid it ?
×

Success!

Help @gwitasod spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...