...

View Full Version : Please...please help, very big problem!



SRBuckey5266
05-24-2009, 05:51 PM
Everytime I make a form, it doesn't work. And what I mean by that is, when I open my form.php file on Mozilla Firefox, It opens with my form. Now, I type in the Information and when I click submit, and go to form_response.php it doesn't show the information that I typed in.

It does this for any form I make. Here are my codes:


<h1>1337programs - Fill-out before entering (Optional)</h1>

<div style="padding:15px; border:1px solid #666666; background-color: #F5F5F5">



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

<div class="form_element_div">
First name: <br> <input name="name_first" type="text" size="50" maxlength="200">
</div>
<div class="form_element_div">
Email: <br><input name="email" type="text" size="50" maxlength="200">
</div>



<div class="form_element_div">
Favorite color:
<INPUT type=radio value="red" name="color">
red
<INPUT type=radio value="yellow" name="color">
yellow
<INPUT type=radio CHECKED value="blue" name="color">
blue
<input type="submit" />

</div>
Now here is the second part, form_response.php:


<div id="topBar"></div>
<div id="navigation" class=container"></div>
<div id="centerDoc" class="container">
<div style="margin-top:25px; margin-bottom:20px; "> </div>


<div>

<?php

// FORM PROCESSING CODE- USING 'SUPER GLOBALS' - 1337programs.110mb.com


$first_name = $_POST['name_first'];
$email = $_POST['email'];










?>

CFMaBiSmAd
05-24-2009, 05:57 PM
Forms need closing tags to make them valid -

</form>

masterofollies
05-24-2009, 05:57 PM
You set the variables, but didn't echo them out. Delete your code in form_response and use this one.


<div id="topBar"></div>
<div id="navigation" class=container"></div>
<div id="centerDoc" class="container">
<div style="margin-top:25px; margin-bottom:20px; "> </div>


<div>

<?php

// FORM PROCESSING CODE- USING 'SUPER GLOBALS' - 1337programs.110mb.com


$first_name = $_POST['name_first'];
$email = $_POST['email'];

echo "Your first name is <b>$first_name</b><br>";
echo "Your email is <b>$email</b>";

?>

SRBuckey5266
05-24-2009, 06:30 PM
You set the variables, but didn't echo them out. Delete your code in form_response and use this one.


<div id="topBar"></div>
<div id="navigation" class=container"></div>
<div id="centerDoc" class="container">
<div style="margin-top:25px; margin-bottom:20px; "> </div>


<div>

<?php

// FORM PROCESSING CODE- USING 'SUPER GLOBALS' - 1337programs.110mb.com


$first_name = $_POST['name_first'];
$email = $_POST['email'];

echo "Your first name is <b>$first_name</b><br>";
echo "Your email is <b>$email</b>";

?>

I did that, and went I hit the submit button, and go to form_response.php I get this:


$_POST ['name_first'];
"; echo "Your email is $email"; ?>

mlseim
05-24-2009, 06:42 PM
What webhost are you using?
Maybe the don't allow PHP scripting?

masterofollies
05-24-2009, 06:45 PM
True its very possible your webhost doesn't support it. 99.9% of free hosts don't support it.

SRBuckey5266
05-24-2009, 06:46 PM
I'm using my localhost.

VIPStephan
05-24-2009, 06:57 PM
May it be this reason (http://www.cs.tut.fi/~jkorpela/forms/methods.html)?

Also, did you exactly copy the code masterofollies provided? Because in your response about the results I see a whitespace (between $_POST and the array object) where no whitespace should occur. And also I don’t see if this is the full output. It may also be that you aren’t pairing quotes correctly. Single quotes and double quotes are mutually exclusive. That means you can’t write $_POST['name_first"]; and expect an acceptable result it should always be the same kind of quote around a string. And if you need to use quotes inside another quoted section you need to either escape the quote with a backslash or use the other type of quotes inside one type (i. e. if you have ouble quotes you need to use single quotes inside that string and vice versa).

Also, what’s the error message PHP should shouw you?

_Aerospace_Eng_
05-24-2009, 09:36 PM
I'm using my localhost.

Do you have a server and php installed?

ArcticFox
05-24-2009, 09:55 PM
<div id="topBar"></div>
<div id="navigation" class=container"></div>
<div id="centerDoc" class="container">
<div style="margin-top:25px; margin-bottom:20px; "> </div>

SRBuckey5266
05-24-2009, 10:24 PM
Can someone just post their own codes and let me test it?

_Aerospace_Eng_
05-24-2009, 10:28 PM
We have but the fact that you seeing the php means its an issue with your system.

ArcticFox
05-24-2009, 11:02 PM
Did anyone try putting a quotation mark in the area I suggested above?

_Aerospace_Eng_
05-24-2009, 11:23 PM
Putting the quote in above won't effect the php output since its client side and not server side. The php runs first then the html.

mlseim
05-24-2009, 11:28 PM
Upload the PHP script below and see if it shows you the result:



<?php
$x=1 + 3;
echo"The sum is: $x";
?>


Tell us what it shows.

ArcticFox
05-25-2009, 12:33 AM
Putting the quote in above won't effect the php output since its client side and not server side. The php runs first then the html.

I would think if it was purely a PHP problem, he would be seeing the entire PHP code, not just:


$_POST ['name_first'];
"; echo "Your email is $email"; ?>

masterofollies
05-25-2009, 12:59 AM
I would think if it was purely a PHP problem, he would be seeing the entire PHP code, not just:


$_POST ['name_first'];
"; echo "Your email is $email"; ?>

That code shown is not what I gave him. It's altered. Plus you can mess up the client coding (html, css) all you want it won't affect anything. Only PHP can cause PHP problems.

CodeSpawn
05-25-2009, 01:15 AM
Well this is a php problem. He said he is doing this with his localhost. He apparently doesn't have PHP and that is the problem. Otherwise something would have worked.

Either upload to a host that supports PHP or download and install PHP on your computer.

Fou-Lu
05-25-2009, 04:32 AM
Putting the quote in above won't effect the php output since its client side and not server side. The php runs first then the html.

These lines:


<?php

// FORM PROCESSING CODE- USING 'SUPER GLOBALS' - 1337programs.110mb.com


$first_name = $_GET['name_first'];
$email = $_GET['email'];

echo "Your first name is <b>

Are interpreted as an html tag, starting at the < before the <?php and ending at the > with <b>. So in this example, the PHP engine is not in use, and this is why only the data after the <b> is viewable as output text.
Since you're page is saved as a .php extension, I'd say offhand that you do not have PHP on you're host.


Nuts I quoted the wrong post of AE's. Oh well, it was supposed to be the one that essentially said that PHP wasn't available.

Argh, totally off today. mlseim was supposed to have a quote too.

VIPStephan
05-25-2009, 08:57 AM
SRBuckey5266 would you be so kind and create a new PHP file with the following content:


<?php phpinfo(); ?>


upload that to your server, load it in your browser, and tell us what you see?

_Aerospace_Eng_
05-26-2009, 06:28 AM
The fact that he said he was able access form.php then php should be working unless the server is treating php as html files or text files.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum