form action=filename in feedback form results in wrong path

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
c2497
Forum Newbie
Posts: 10
Joined: Wed Aug 06, 2003 8:18 pm

form action=filename in feedback form results in wrong path

Post by c2497 »

I have the following:
<form action="sendfeedback.php" method="POST">

and the sendfeedback.php file is in the same dir as the form.php file. But when I click on submit I don't get the right path. I see:

http://localhost:8080/bse/contacts/bse/ ... edback.php
(notice the duplicaiton of bse/contacts in url).

I want it to up at:
http://localhost:8080/bse/contacts/sendfeedback.php

Any reason why it is putting part of the path url in twice?

I tried the full path:
<form action="http://localhost:8080/bse/contacts/sendfeedback.php" method="POST">

and <form action="c:/program files/apache group/apache2/htdocs/bse/contacts/sendfeedback.php" method="POST">

(right now I am testing this on my desktop).

I have apache2, php, and mysql running. No other problems with it finding other pages.

Also, I am confused by something. Do I need double quotes or no quotes around the action file name?

Help would be appreciated.

Thanks
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Wierd...
Would this work?

Code: Select all

<form method="post" action="<?php echo 'http://'.$_SERVER['SERVER_ADDR'].dirname($_SERVER['PHP_SELF']).'/sendfeedback.php'; ?>">

Result:
<form method="post" action="http://192.168.0.2/test/sendfeedback.php">
And you need double quotes around every value in html.
c2497
Forum Newbie
Posts: 10
Joined: Wed Aug 06, 2003 8:18 pm

Will check out possible fix for my problem

Post by c2497 »

I will try this tomorrow morning and post results.

Thanks for the code.
c2497
Forum Newbie
Posts: 10
Joined: Wed Aug 06, 2003 8:18 pm

why does it display text of the .php file

Post by c2497 »

I was a goof ball. I realized I had <? but not <?php at the beginning of the code. But now using:
<form action="http://localhost:8080/bse/contacts/sendfeedback.php" method="POST">

it opens up and displays the text version of the sendfeedback.php file instead of executing the code for it?

Anyone know what I'm doing wrong?

Thanks.
Post Reply