By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Form submission fills form values with garbage

P: n/a
Hey all,

I'm attempting to do some form processing on a server that has
register_globals off, however, I've run into a confusing situation and
need some help.

Basically, the form is a multi-part/form-data form as I have it upload
a file in addition to submit a number of other fields, but the error I
have occurs even when no upload is done.

When I submit the form, all my input field variables get filled with
garbage. Here's the html before submission for one of the fields:

<FORM name="product" action="product.php?mode=add" method="post"
encType="multipart/form-data">
<INPUT type=hidden value=100000000 name=MAX_FILE_SIZE>
Product Name: <INPUT VALUE=<? print ("\"$productname\""); ?> size=30
name=productname>

The form submits to itself and does some error checking, but to try to
figure this out, I print the variable from the form submission before
my code even touches it at the top of the page and it's garbage.

echo $_POST["productname"];

To see an example of all the garbage my fields get, you can look at
http://www.ratlhead.com/php.gif And the garbage there changes...it's
random. You can see my echo statement that I do right before doing
any PHP stuff.

I'm totally confused, as I had this code working on another server,
but not on this one. And I'm guessing something to do with the PHP
enviroment is the problem.

Any input would be appriciated! Thanks!
Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
ra******@ratlhead.com (ratlhead) schrieb:
Product Name: <INPUT VALUE=<? print ("\"$productname\""); ?> size=30
name=productname>

The form submits to itself and does some error checking, but to try to
figure this out, I print the variable from the form submission before
my code even touches it at the top of the page and it's garbage.
Try

Product Name: <INPUT VALUE="<?php echo($productname); ?> size="30"
name="productname">

I'm totally confused, as I had this code working on another server,
but not on this one. And I'm guessing something to do with the PHP
enviroment is the problem.


Please give us the versions of PHP on both servers.

Regards,
Matthias
Jul 17 '05 #2

P: n/a
Matthias Esken <mu************@usenetverwaltung.org> wrote in message news:<bk*********@usenet.esken.de>...
Try

Product Name: <INPUT VALUE="<?php echo($productname); ?> size="30"
name="productname">

Please give us the versions of PHP on both servers.

Regards,
Matthias


I tried what you mentioned and still get the problem. Both PHP
versions are 4.3.3

I know it sounds totally whack that randomly that form works and other
times it doesn't, but that's how it's been going when I don't touch
the code and submit the form blank. Someone suggested maybe it's the
default charset in the php.ini file, but that's not the case.

I know none of that is much help, but I'm not sure what else to say
without posting the whole file, which I don't really think is
necessary.

Thanks for the help and suggestion!
Jul 17 '05 #3

P: n/a
> I know none of that is much help, but I'm not sure what else to say
without posting the whole file, which I don't really think is
necessary.

Thanks for the help and suggestion!


Is it always YOU who submit the data? i ran into a similar
trouble when people using MACs submitted their Data. Totaly
confusing characters came along.

regards

timo

Jul 17 '05 #4

P: n/a
ra******@ratlhead.com (ratlhead) wrote in message > > Try

Product Name: <INPUT VALUE="<?php echo($productname); ?> size="30"
name="productname">


for what it's worth, you're missing the closing value paren ( should
be one after '?>') which probably results in different problems.

Product Name: <INPUT VALUE="<?php echo $_POST['productname']; ?>"
size="30" name="productname">

What is the value that you entered in your screen cap? was it
"body"something?

Occasionaly I get strange transfers when my server is heavily
loaded...
Jul 17 '05 #5

P: n/a
"ratlhead" <ra******@ratlhead.com> wrote in message
news:fd**************************@posting.google.c om...
Hey all,

I'm attempting to do some form processing on a server that has
register_globals off, however, I've run into a confusing situation and
need some help.

Basically, the form is a multi-part/form-data form as I have it upload
a file in addition to submit a number of other fields, but the error I
have occurs even when no upload is done.

When I submit the form, all my input field variables get filled with
garbage. Here's the html before submission for one of the fields:

<FORM name="product" action="product.php?mode=add" method="post"
encType="multipart/form-data">
<INPUT type=hidden value=100000000 name=MAX_FILE_SIZE>
Product Name: <INPUT VALUE=<? print ("\"$productname\""); ?> size=30
name=productname>

The form submits to itself and does some error checking, but to try to
figure this out, I print the variable from the form submission before
my code even touches it at the top of the page and it's garbage.

echo $_POST["productname"];

To see an example of all the garbage my fields get, you can look at
http://www.ratlhead.com/php.gif And the garbage there changes...it's
random. You can see my echo statement that I do right before doing
any PHP stuff.

I'm totally confused, as I had this code working on another server,
but not on this one. And I'm guessing something to do with the PHP
enviroment is the problem.

Any input would be appriciated! Thanks!


I'll throw in my two pence worth...

first... have you tried createing another form, something basic that has two
boxes in it for example, and then seeing if you can post the data
successfully on your own server?

secondly... I'm just trying to be helpful here... but what you could do is
change the action on your server to post it to mine... I'll leave it up for
a day but you could change it to something like <FORM
ACTION=http://www.wiredwords.net/phpinfo.php METHOD=POST> and see the
result... Its not a full PHP info, it just dumps POST, GET and REQUEST data
in to a table... if it turns up corrupted there then it might be client
related... at least it should help you get one step closer to resolveing the
problem...

I'll disable the script within 24hours unless you email me otherwise... you
can email me at
randelld
at
fiprojects
dot
com

cheers
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.