Page 1 of 1

form action=filename in feedback form results in wrong path

Posted: Sat Dec 27, 2003 9:03 am
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

Posted: Sat Dec 27, 2003 12:02 pm
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.

Will check out possible fix for my problem

Posted: Sat Dec 27, 2003 4:03 pm
by c2497
I will try this tomorrow morning and post results.

Thanks for the code.

why does it display text of the .php file

Posted: Sat Dec 27, 2003 7:05 pm
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.