Login | Register | FAQ
Anonymous

Problem passing hidden field.

+ Post a reply

5 posts Page 1 of 1


Problem passing hidden field.

by aris » Wed Apr 18, 2012 2:13 am

i am Working on a web app called Converser (http://converser.hostei.com/), and I came with a problem were the php gave a 404 error message because it went to /chat/.php, and it couldn't find the hidden field 'handle'.
Join.php:
Code: Select all
<html>
<head>
<title>
Joining
</title>
</head>
<body bgcolor="#D7EE98">
<form action="joining.php">
<?php
$v = $_POST['chatter']
echo "<input type='hidden' name='cn' value='" . $v . "'>";
?>
Enter your handle:
<br/>
<input type="text" name="handle">
<br/>
<input type="submit" value="go!">
</form>
</center>
</body>
</html>

Code: Select all
<?php session_start();?>
<html>
<head>
<title>
.
</title>
</head>
<body>
<?php
$chat = $_POST['cn'];
$_SESSION[name] = $_POST['handle'];
Header("Location: http://converser.hostei.com/chat/" . $chat . ".php");
?>
</body>
</html>
User avatar

aris

  • Posts: 23
  • Joined: Sun Apr 15, 2012 6:00 pm

Re: Problem passing hidden field.

by XainPro » Wed Apr 18, 2012 7:36 am

you are getting handel by $_POST super global
and you did not mentioned in form starting tag by which method you are submiting the form
i.e
Code: Select all
<form action="joining.php">


is should be changed to

<form action="joining.php" method="post">

after this change it should work properly.
XainPro
User avatar

XainPro

  • Posts: 3661
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: Problem passing hidden field.

by rr_campaign » Wed Apr 18, 2012 1:31 pm

Check please if the problem is here
Header("Location: http://converser.hostei.com/chat/" . $chat

Try to change it to:
Header("Location: http://converser.hostei.com/chat//" . $chat

regards
Mario
--
zaproszenia ślubne
User avatar

rr_campaign

  • Posts: 1
  • Joined: Wed Apr 18, 2012 1:06 pm

Re: Problem passing hidden field.

by XainPro » Thu Apr 19, 2012 10:07 am

i am beginner as well but i mean to say the solution i have provided i think was correct :) 2nd solution provided by aris is i don't think the correct 1 :)

Last edited by XainPro on Thu Apr 19, 2012 12:37 pm, edited 1 time in total.

User avatar

XainPro

  • Posts: 3661
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: Problem passing hidden field.

by XainPro » Sat Apr 21, 2012 10:14 am

thanks and you are welcome :)
User avatar

XainPro

  • Posts: 3661
  • Joined: Fri Feb 17, 2012 8:10 pm


+ Post a reply

Page 1 of 1