Relative Form Actions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
LiveFree
Forum Contributor
Posts: 258
Joined: Tue Dec 06, 2005 5:34 pm
Location: W-Town

Relative Form Actions

Post by LiveFree »

Hey,

I am using Smarty to display a html form, and the form has the same action as the page that displayed the form (admin.php).

I have the <form method="POST" action="admin.php"> but when I test for that the admin.php page is recieving the POST input using an echo, nothing echoes out.,

So what Im asking is, what path do I need to put in the action paramater for the form to post to admin.php.

And for reference:

Path to Form: /styles/timberwolf/admin/login_body.htm
Path to Display File: admin.php/

Thanks!
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

what does it say in the url when you post what you've currently got? That's going to be your best clue as to where the script is going.

The tpl files can be anywhere on the hard drive, they have nothing to do with relative paths (unless you specifically set something within the template itself).

if I have my admin.php file and I use:

Code: Select all

$smarty->display("/some/path/to/some/tpl/file/blah.tpl");
if in that tpl file have a form with an action of admin.php, it should go straight back to the page that posted it.

check your url to see where it's going though.
LiveFree
Forum Contributor
Posts: 258
Joined: Tue Dec 06, 2005 5:34 pm
Location: W-Town

Post by LiveFree »

When I hit submit, it refreshes the page but the issue is I do not see any of the test code I have to see if PHP is picking up on the POST var

Code: Select all

if (isset($_POST['admin_login'])) {
And yes, Im sure that is the correct name for the submit button.

Thanks Burrito!
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

I've seen cases where that input element (type submit) is not passed in post array (in IE I think). Try a print_r() on your post array to see what it shows.
Post Reply