Hi,
Please help me out.

1. Getting HYPERLINK value from page1 and saving in page2 using GET method.($re=$_GET[variable];)

2. Passing this value in -> select query

3. Displaying my output - correctly(in each and every value, there is an SUBMIT button.)

4. My Form Action is page2 itself.

5. Due to this, by submitting the form, my GET method value becomes NULL.

6.Displaying my output - incorrectly(selecting all NULL field values in WHERE CLAUSE)


Please help me out.Thanks in advance

Maybe you can specify your question with code samples. The first thing I think of is: does you form action contain Get-parameters? Or does it perform a Post? In that case use should question your form with $__POST[variable]. With $__REQUEST[variable] you can look for both Post an Get variables.

Hi,
In Page1

print "<a href=http://page1.php?code=pcode>click</a>";

In Page2

<?php
            ((isset(submit)) && (isset(submit)=="Upload file"))
            {
                 // code here 
            }
      $result=$_GET['code'];
      $qur="select name,lastname from table where id='$result'";
       ----code------
       html table tag opened
       while loop
       {
           displaying the output in browser -->first time correctly
           ------code goes here-------

            echo "<form action='page2.php' method='post' enctype='multipart/form-data'>";
  echo "<input type='hidden' name='id' value='$pid'>";
  echo "<input type='hidden' name='pe' value='$pp'>";
  echo "<input type='hidden' name='result' value='$result'>";
  echo "<td><input type='file' name='uploaded_file'></td>";
  echo "<td><input type='submit' name='Submit' value='Upload file'></td>";
  echo "</form>";
  echo "</tr>";
       }
       ---------------

     
      ?>

1.first time - displaying the output in the browser correctly from select query(getting the value from gets method -from select query WHERE $id='value').
2.Now - i am clicking submit button
3.displaying the output in the browser incorrectly from select query(NOW get method value become ZERO -displaying all values -from select query WHERE $id='').

Please help me out. Thanks in advance

Hi,

Inside SUBMIT button, am not facing any problem. Outside SELECT Query --its giving problem. How to sort out this.GET METHOD values -> why becoming empty string.

You are posting some variables with your second form but tries to read them with $_GET. You should use $_REQUEST[variable] to read both GET-params and POST-params.

facing problem in this

$result=$_GET['code'];

hi,

where i should use this $_REQUEST[variable] ? please point out in my above coding.

Use

$result=$_REQUEST['code'];

and add line

echo "<input type='hidden' name='code' value='pcode'>";

to your form

$result=$_REQUEST['code'];
echo "<input type='hidden' name='code' value='pcode'>";

You told to do as the above one,

$result=$_REQUEST['code'];
echo "<input type='hidden' name='code' value='$result'>";

value is $result
or
value is $pcode

Value can be of anything.

hi,
Really i thank of you.Its working.thanks a lot

OK, I didn't see that, I only saw 'pcode'. Is your problem solved? (sorry I was a little early)

yes, my problem is solved. Nearly, i spent half a day in this. From you, i learned about $_REQUEST method. thanks once again

Hi,

again i am facing the same problem, while redirecting the page

   if(condition)
   {
      header("Location:page2.php");
      exit("error");
   }

The $_REQUEST['variable'] -> getting null. How to fix this error.

:-)

if( condition )
{
    header("Location:page2.php?code=$pcode");
    exit("error");
}

i tries the same thing.its working.One more doubt, my exit() function showing error message in new browser window. So only, i am using header(), but this function redirect to PAGE2.PHP(home page) without showing any error message. If any error message means, i wants to stop execution of the script using exit("error message"). but "error message" should display in the same browser window

I don't understand you completely. Do you want the execution to stop if an error message contains any text? Or do you want sonething else? Your script is writing a header - that makes the browser to redirect in this case - and after that your PHP-script-executions is ordered to stop (by calling exit) while writing a message. Both the header and the messages are sent to the visiting client, that is first redirect and after is writing the message.
If you only wants to display the errormessage you should redirect. If you only wants to redirect don't write any message.