Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

trouble with the post function

Codes here !

Moderators: macek, egami, gesf

trouble with the post function

Postby tranquillo » Mon Jan 20, 2003 7:12 am

hi..

I've created a guestbook and it works just great on my comp. but now when I put it on a free test server it won't work anymore...

I'm using a form with the post action thing to a new php page, and there I've done a $txt = $_POST["txt"]; connection. but something's not working, because nothing is entered into the database. is there a problem using that $txt = $_POST["txt"]; connection thing on some servers or something?
and I'm sure it's that or the form that's the problem. been trying to change everything else...

this is the code:

guestbook.htm
-------------------
<form name="guestbook" method="post" action="guestbook.php">
<p><br><table border="0" class="textsmallbold"><tr>
<td>Namn : </td>
<td><input type="text" name="namn"></td></tr>
<tr>
<td>E-post : </td>
<td><input type="text" name="epost"></td></tr>
<tr>
<td>Meddelande : </td>
<td>
<textarea name="txt"></textarea>
<input type="submit" name="Submit" value="Submit" class="button">
---------------------

guestbook.php
---------------------
<?php
$db = mysql_connect("localhost", "xxxxxx", "xxxxxx");
mysql_select_db("DB_nac88321",$db);
$namn = $_POST["namn"];
$epost = $_POST["epost"];
$txt = $_POST["txt"];

if ($txt) {

(insert query and all that)

?>


<?php
} else {
printf("<meta http-equiv='refresh' content='0;URL=forgot.htm'>\n");
}
?>

-------------
would be realy happy if someone could tell me what's wrong, and why... it just buggs me coz it worked fine until I put it on another server...

what happens when I try to enter a message to the guestbook is that it's just totaly ignored. it says I haven't put any text in the textbox... but I'm sure I have... and if I get rid of that "if ($txt)" thing nothing happens... one message is entered in the guestbook, but it's blanc. it's like nothing is sent to the guestbook.php page at all. or that the connection thing don't work...
please help.. ;)

-s
tranquillo
New php-forum User
New php-forum User
 
Posts: 74
Joined: Sun Nov 24, 2002 6:48 pm
Location: katrineholm

Postby Joan Garnet » Tue Jan 21, 2003 5:49 am

Maybe they have an earlier version of PHP than 4.1.0
Introduced in 4.1.0. In earlier versions, use $HTTP_POST_VARS.

Try using
Code: Select all
$txt = $HTTP_POST_VARS["txt"];

bye!
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Postby tranquillo » Tue Jan 21, 2003 6:18 am

it worked...
damnit...
they brag about using php4... is there a earlier version of php4 than 4.1.0?
tranquillo
New php-forum User
New php-forum User
 
Posts: 74
Joined: Sun Nov 24, 2002 6:48 pm
Location: katrineholm

Postby tranquillo » Tue Jan 21, 2003 6:21 am

b.t.w.

thank you sooo much for all your help.

:D
tranquillo
New php-forum User
New php-forum User
 
Posts: 74
Joined: Sun Nov 24, 2002 6:48 pm
Location: katrineholm

Postby Joan Garnet » Tue Jan 21, 2003 1:33 pm

Good :D I'm glad that it worked!

Which server is that??
I want to know so I can recommend it to people interested on learning php :)
It's not a normal thing to find free php servers. isn't it?
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron