something wrong with the path..

They have: 164 posts

Joined: Nov 2001

$url_site = abc.com/test/

in my code, my form action is like this:

<?php
echo \"<form method=post action=\\"$url_site/template/admin.php\\">\";
?>

when i test, this path is wrong.
it wil have something like this:

<?php
<a href=\"http://www.abc.com/template/www.abc.com/test/template/admin.php\" class=\"bb-url\">http://www.abc.com/template/www.abc.com/test/template/admin.php</a>
?>

why will this happen? how can i solved it??

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

What I do in cases like that, is just start echoing the var in question. Keep echoing it further and further up in your script until it's correct. Then you should have a general idea of where it's getting borked.

Another option is to do a search in all documents that touch that var. It's getting changed somewhere.

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 164 posts

Joined: Nov 2001

solved that problem. i was told to put a http :

<?php
$url_site
= <a href=\"http://www.abc.com/test\" class=\"bb-url\">http://www.abc.com/test</a>
?>

but i found another path problem, which is..i got something like a folder tree. the last level, which is the child, will have this path:

<?php
<a href=\"http://http://www.abc.com/test/template/admin.php\" target=\"_blank\"><a href=\"http://http://www.abc.com/test/template/admin.php\" class=\"bb-url\">http://http://www.abc.com/test/template/admin.php</a></a>
[php/]

i put the path as:

[PHP]
$url_site/template/admin.php
?>

wat cuold be this problem??

Busy's picture

He has: 6,151 posts

Joined: May 2001

This is way over my head as I'm still learning php but am interested as I may run into similar problems down the line.

would the quotes be affecting the $url_site ?

would ddouble quotes around it help with \'s infront of the other quotes used or even single quotes ?

$url_site = "http://www.abc.com/test"

They have: 601 posts

Joined: Nov 2001

You're thinking of interpolation? In perl this does make a difference, although it should not make a difference in the case of assigning a value to a scalar. It would make a difference if you were trying to assign one scalar to another however.

$scalar = "$scalar";
$scalar = '$scalar';

..are different, or at least in Perl. I don't code PHP personally.

Cheers

- wil

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I'm a bit lost.

But I do see two 'http://' in those URLs.
And I see that $url_site does not have it's full value in quotes. (as busy mentioned)

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.