By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,442 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,442 IT Pros & Developers. It's quick & easy.

header

P: n/a
Hi,

I have this problem

<?php

$doc = "name";

$result = "code";

header('Location: content2.php?docCode= $doc + resultCode=$result');

?>

I have two variabeles (doc and result) i want to pass to content2.php

There i will get them

$doc_n = $_GET('docCode');

$result_n=$_GET('resultCode');

What's wrong with my header?

Thanks

Alain

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Alain Dhaene wrote:
<?php
header('Location: content2.php?docCode= $doc + resultCode=$result');
?> What's wrong with my header?

Too many spaces; wrong syntax.

Try (after changing server and path)

header('Location: http://server.com/path/to/content2.php?' .
'docCode=' . urlencode($doc) .
'&amp;resultCode=' . urlencode($result));
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2

P: n/a
Alain Dhaene wrote:

Hi,

I have this problem

<?php

$doc = "name";

$result = "code";

header('Location: content2.php?docCode= $doc + resultCode=$result');

?>

I have two variabeles (doc and result) i want to pass to content2.php

There i will get them

$doc_n = $_GET('docCode');

$result_n=$_GET('resultCode');

What's wrong with my header?


You should put in the full URL, as some browsers don't support relative urls.
You should not put spaces in your url. (these will usually work in IE, but NS 4
work accept them)
Different variables must be seperated with "&", not "+".
Your variables should be url encoded.

Try this:

header('Location:
http://yoursite.com/content2.php?docCode='.urlencode($doc).'&resultCod e='.urlencode($result));

Regards,
Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.