470,815 Members | 1,350 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

form input problem

Hi

I've got a form with an input field called 'cluster' and which posts
to another page where $cluster is printed.

The problem is if for instance I put ABCD in the field I get
ABCDcluster=ABCD printed on the next page and not just ABCD which is
what I want.

see http://convoluta.cap.ed.ac.uk/Lumbri...ibasetest1.php
for a demo.

I can use a regex to get rid of the extra text but can anyone tell me
where it's coming from?

Scripts below.
Many thanks for any suggestions.

lumbribasetest1.php

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta name="keywords" content="earthworms, blast, Lumbricus,
pollution">
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; I; Linux
2.2.13-0.9 alpha) [Netscape]">
<title>Lumbribase Search</title>
</head>

<body text="#000000" bgcolor="#E0EEEE" link="#0000EF" vlink="#51188E"
alink="#FF0000">
<center>

<!--#############################################
#### Banner at top of page ####
#############################################-->
<table WIDTH=80% border=0 cellpadding=0 cellspacing=0>
<tr>
<td WIDTH=33%><P><IMG SRC="earthworm.jpg" WIDTH=100%
HEIGHT=112></P></td>
<td WIDTH=34% align=center bgcolor="#556B2F"><font size=6
color=#FFFFFF> LumbriBASE<br>searches</font></td>
<td WIDTH=33%><P><IMG SRC="earthworm.jpg" WIDTH=100%
HEIGHT=112></P></td>
<tr>
</table>

<br>

<!--#############################################
####search by cluster/clone/protein name ####
#############################################-->
<table WIDTH=80% BORDER=0 CELLSPACING=0 CELLPADDING=10
bgcolor="#AADAAA">
<form method="post" action="pg_nametest1.php">
<tr><td align=center><font size=5>Search by sequence
identity</font></td></tr>
<tr><td align=center><i>L. rubellus</i> cluster (e.g. LRC00138) or
<i>C. elegans</i> protein (e.g. CE01234)</td></tr>
<tr><td align=center><input type="text" name="cluster"><input
type="submit" value="Search"></td></tr>
</form>
</table>
</body>
</html>

pg_nametest1.php

<?php

if($cluster) {
print "What you entered in the text field should be between these
stars *$cluster*";
}
else {
print "You didn't enter a cluster name";
}
?>
Jul 17 '05 #1
8 1600
I noticed that Message-ID:
<5b**************************@posting.google.com > from annie contained
the following:
I can use a regex to get rid of the extra text but can anyone tell me
where it's coming from?


Odd. I can't reproduce the error. Have you tried escaping the stars?

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
I noticed that Message-ID: <fh********************************@4ax.com>
from Geoff Berrow contained the following:
I can't reproduce the error.

Here is how I tried
http://www.ckdog.co.uk/php/test/stars.php

<form method="post" action="">
<tr><td align=center><font size=5>Search by sequence
identity</font></td></tr>
<tr><td align=center><i>L. rubellus</i> cluster (e.g.
LRC00138) or
<i>C. elegans</i> protein (e.g. CE01234)</td></tr>
<tr><td align=center><input type="text"
name="cluster"><input
type="submit" value="Search"></td></tr>
</form><?php

if($cluster) {
print "What you entered in the text field should be between
these
stars *$cluster*";
}
else {
print "You didn't enter a cluster name";
}
?>

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #3
annie wrote:
I've got a form with an input field called 'cluster' and which posts
to another page where $cluster is printed.

The problem is if for instance I put ABCD in the field I get
ABCDcluster=ABCD printed on the next page and not just ABCD which is
what I want.
(snip)
pg_nametest1.php

<?php

if($cluster) {
print "What you entered in the text field should be between these
stars *$cluster*";
}
else {
print "You didn't enter a cluster name";
}
?>


Is this your full pg_nametest1.php?

If it isn't (because you have register_globals off) how do you set
$cluster?

What is the contents of $_POST?
try <?php echo '<pre>'; print_r($_POST); echo '</pre>'; ?>
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #4
Very curious???

If I put a second text field on the form both variables are fine when
they get to the next page!

example:-
http://convoluta.cap.ed.ac.uk/Lumbri...ibasetest2.php

So what is going on???

I'm on Linux 2.4.20, PHP 4.2.2-17 and Postgresql 7.3.2-3. I haven't
been able to come up with an apache version.

Cheers
Jul 17 '05 #5
annie wrote:
Very curious???

If I put a second text field on the form both variables are fine when
they get to the next page!
What happens if you add a hidden field?

<input type="hidden" name="strange" value="very">

example:-
http://convoluta.cap.ed.ac.uk/Lumbri...ibasetest2.php

So what is going on???
No idea. It works as expected for me.
I'm on Linux 2.4.20, PHP 4.2.2-17 and Postgresql 7.3.2-3. I haven't
been able to come up with an apache version.


Not that it matters, but you can get Apache's version with
apache_get_version()

http://www.php.net/apache_get_version

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #6
As others are not able to replicate the error I guess it must be
something to do with the server setup though I'm totally baffled as to
why it works for froms with more than one input field.

For now I'll stick with the very dirty regual expression fix. Thanks
for your help anyway.

Annie
Jul 17 '05 #7
"annie" <ba****@hotmail.com> wrote in message
news:5b*************************@posting.google.co m...
As others are not able to replicate the error I guess it must be
something to do with the server setup though I'm totally baffled as to
why it works for froms with more than one input field.

For now I'll stick with the very dirty regual expression fix. Thanks
for your help anyway.

Annie


Yup, it's definitely a bug somewhere in your copy of PHP. When I did a post
against your phpinfo page I saw this:

_POST["cluster"] => Hello worldcluster=Hello world

To bypass this bug, stick this into your form tag so that PHP uses a
different code path to parse the form data:

enctype="multipart/form-data"
Jul 17 '05 #8
Pedro Graca <he****@hotpop.com> wrote in message news:<2g************@uni-berlin.de>...
annie wrote:
Very curious???

If I put a second text field on the form both variables are fine when
they get to the next page!


What happens if you add a hidden field?

<input type="hidden" name="strange" value="very">



Thanks Pedro, The hidden field works and it's a better fix than mine.
Jul 17 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Norman Bird | last post: by
6 posts views Thread by Jeff Dunnett | last post: by
10 posts views Thread by Gregory A Greenman | last post: by
4 posts views Thread by Alex Sibilev | last post: by
1 post views Thread by fugaki | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.