Solved

what's wrong with this PHP script

Posted on 2012-03-30
15
232 Views
Last Modified: 2012-04-03
<form action="page3-belief-audit" method="post">
<?php echo $_POST["belief1"] ?> because I <input type="text" size="100" name="becauseI" /></input>
<?php echo $_POST["belief1"] ?> after I <input type="text" size="100" name="afterI" /></input>
<?php echo $_POST["belief1"] ?> before I <input type="text" size="100" name="beforeI" /></input>
<?php echo $_POST["belief1"] ?> when I <input type="text" size="100" name="whenI" /></input>
<?php echo $_POST["belief1"] ?> as I <input type="text" size="100" name="asI" /></input>
<?php echo $_POST["belief1"] ?> although I <input type="text" size="100" name="althoughI" /></input>
<?php echo $_POST["belief1"] ?> so that I <input type="text" size="100" name="sothatI" /></input>
<input type="submit" />
</form>

It's putting text inside the box, I attached what it looks like when the page loads
ee1.gif
0
Comment
Question by:weikelbob
  • 3
  • 3
  • 2
  • +4
15 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 84 total points
ID: 37789646
The first thing is that that textarea is not in the list you posted above.  Matter of fact, I don't see that any of what you posted is in that pic.
0
 
LVL 7

Assisted Solution

by:designatedinitializer
designatedinitializer earned 84 total points
ID: 37789647
the attached image cannot be the result of the script snippet you posted.
Will you check that and post again?
0
 
LVL 2

Assisted Solution

by:DangItMarilyn
DangItMarilyn earned 83 total points
ID: 37789669
It looks to me like you didn't close your text area tag or closed it with an open <br> between.

Of course that's not evident in the code you posted, it's just a guess.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 9

Assisted Solution

by:rinfo
rinfo earned 83 total points
ID: 37790688
Yes it definitely having a <Br> in the textarea description .
The reason i suppose is you wants to break value for textarea in to particular lines.
So for displaying string linewise you have added <br> before post array  and that is not the way to do it.
Or maybe you wanted to have some space before the textarea but some how it is included in the textarea declaration.
0
 
LVL 10

Assisted Solution

by:acbxyz
acbxyz earned 83 total points
ID: 37791072
Unlike input elements, textarea is not self-closing.
<textarea name="belief1"></textarea>
0
 
LVL 7

Expert Comment

by:designatedinitializer
ID: 37791128
this is hard to debug because you haven't provide us the necessary information (your screenshot is NOT the result of the code you posted).
However, you have a big mistake in your listing that so far as gone unnoticed.
You can't use this:

<input type="text" size="100" name="becauseI" /></input>

You either use this:
<input type="text" size="100" name="becauseI" />

OR this:
<input type="text" size="100" name="becauseI" ></input>

This looks the same as what you've got, but notice the slash...
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37791257
Until we get a response from the author, we're just guessing here.
0
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 83 total points
ID: 37793181
Please post the actual URL of the HTML form page.  Then we can use "view source" to see what the HTML contains.  After the form has been posted you can add these three lines to the top of your PHP action script and you will be able to see what the HTML form sends to the action script.
echo "<pre>";
var_dump($_POST)
;echo "</pre>";

Open in new window

0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 37793183
Crap.  EE code snippet editor bites again.
echo "<pre>";
var_dump($_POST);
echo "</pre>";

Open in new window

0
 
LVL 7

Author Comment

by:weikelbob
ID: 37797345
Woops, wrong code:

<form action="page2-belief-audit" method="post">
<textarea name="belief1" rows="5" cols="100">
</textarea>
<input type="submit" />
</form>
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 37797393
What are we to make of that?  It would be so much easier to help you if you would work with us here.  We need to see the HTML of the entire web page.  What we have seen so far cannot possibly cause the issue shown in the GIF image.  Something else is in play.  It's unreasonable for us to guess when you have the code in front of you and we cannot see it.
0
 
LVL 9

Expert Comment

by:rinfo
ID: 37799317
I entirely agree with Ray .
From this
   Woops, wrong code:

<form action="page2-belief-audit" method="post">
<textarea name="belief1" rows="5" cols="100">
</textarea>
<input type="submit" />
</form>
its amply clear that problem is somewhere else and not in this form declaration.
0
 
LVL 2

Expert Comment

by:DangItMarilyn
ID: 37801199
Perhaps it's a proprietary page you don't want to share? Maybe you should look at anything that isn't "static" that includes the </ br> code that could be showing up in the area or if there is something from the way the page loads that populates the "belief1" field pre-load as if it was being submitted to the page.

Again, I'm just trying to steer you in the right direction since the page seems to be something you'd rather not share.
0
 
LVL 7

Author Comment

by:weikelbob
ID: 37803224
I got this. It was in wordpress and I was working with a plugin that put PHP inside of the wordpress admin, so I didn't have direct access to the full code (though I could have gone View-> source.

Since it was in wordpress, a space and line break between <textarea> and </textarea> was showing up as a <br />

I want to apologise that I did not ask the correct question. You guys are always so helpful.

I will be more careful and thorough next time.

Thank You,

Bob
0
 
LVL 2

Expert Comment

by:DangItMarilyn
ID: 37803311
Glad you got it figured out :)
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why is my wamp get_include_path() wrong? 2 21
Code Manager | Snippits 2 36
reverse engineer .sql from php files 11 35
Checking https returns 301 21 26
This article discusses how to create an extensible mechanism for linked drop downs.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question