DIGIT-ARC read-only archive · snapshot: July 23, 2026

What is wrong with this php code?

10 posts · originally from https://geek.digit.in/community/threads/what-is-wrong-with-this-php-code.107263/

Sridhar_Rao
Sridhar_Rao Original post #1
Jan 24, 2009 at 2:36 PM
Hello,
I had created a html page with form in it. I submit the page to say result.php

<form name="poll" action="result.php" method="post" >

For some reasons, nothing was showing up in result.php page. I have checked and confirmed that the form is submitting correct values as they were delivered to my email. The values were not being received well the php page. I found this script in the net which is supposed to help see if the form submission works correctly or not. I changed the line to:

<form name="poll" action="x.php" method="post" >

Here is the content of page x.php

PHP:
<?
session_start();

echo "<b>PHP Errors:</b><br><br>";// Displays general PHP errors.

error_reporting(E_ALL);

echo "<br><br>**********<br><br>";// This section is for checking Session Vars.



echo "<b>Session Values:</b> <pre>";
print_r($_SESSION); 
echo "</pre>";

echo "<br><br>**********<br><br>";// This section is for checking form submissions.

        echo "<b>Post Values:</b><br><br>";
while(list($key,$value) = each($HTTP_POST_VARS)) { 
        if(is_array($value)) { 

            while(list($key2,$value2)=each($value)) { 
                echo "array $key: $key2 -> $value2"; 
                echo "<br>";
            } 
        } else { 
            echo "$key -> $value"; 
            echo "<br>";
        } 
    }
?>
The page calling this www.microrao.com/opinion.htm. The page gets redirected to x.php but nothing shows up. While google chorme throws up totally blank page, Firefox shows the php script partially.

Please look into this and let me know what the problem is.
Q
Jan 24, 2009 at 3:55 PM
Make the first line
<?php
instead of
<?
furious_gamer
Jan 24, 2009 at 4:54 PM
^^ No need to do so. That one is short tags and cause no problems. The problem lies with the Web Server. Are you sure your Web Server runs any other PHP pages.Please check that out too.
victor_rambo
Jan 24, 2009 at 8:03 PM
The action attribute of your form is wrong, its pointing to "opinion.php" and not "x.php".
If x.php is accessed directly through address bar, I do get what is expected.

If the script is shown partially(if it really does), then you must use PHP complete opening tags, else allow short tags!
Sridhar_Rao
Jan 24, 2009 at 8:12 PM
Thanks for your replies!

I have been trying like mad over the past few hours getting it right. In the process, I have been juggling and changing the lines and links. Sometimes it was x.php, or x2.php or opinion.php. I was modifying codes, adding little by little and tried to determine where exactly was the mistake.

While doing this troubleshooting I came across a simple flaw, I missed a "}" in several of the scripts. Even though error reporting was on, it never got displayed. I fixed it and it now works.:p

I was looking for you, victor_rambo; are you rohan shenoy by any chance?
victor_rambo
Jan 24, 2009 at 9:06 PM
ya, I am Rohan Shenoy :D
D
Jan 29, 2009 at 2:47 PM
hi friends...

its me dhanush... a new comer to ur discussions.....

myself too using php in connection with AJAX.

i wish to use objects in php.....

but i didnt receive any o/p.....

can anyone help me......

thanks in advance
furious_gamer
Jan 29, 2009 at 4:18 PM
Why dont you put your code and what o/p you got here