59258

$_SERVER['PATH_INFO'] ..Undefined index: PATH_INFO

Question:

I am using a code to be put as a header:

$fullurl=$_SERVER['PATH_INFO']; echo ' <form action="'. $fullurl .'" method="POST"> <table width="1000" border="1" cellpadding="10" id="navigationBar"> <tr> <td> <a href="/PoliticalForum/Registration.php">Register</a></td> <td> <a href="/PoliticalForum/controlPanel.php">Control Panel</a></td> <td> <a href="/PoliticalForum/checkEmail.php">Donate</a> </td> <td align="right">name:<input name="name" type="text" /></td> <td>password:<input name="pass" type="text" /> <input name="login" type="submit" value="Login" /> </td> </tr> </table> </form> ';

I include the header across page files with the require once. What I want is that the fullurl variable to obtain the full url of the page it is "required_once" on, and when I click submit, I want it to redirect to the page the header is on.. I added the url onto the action of the form..

But what I get is this:

Undefined index: PATH_INFO

I tried to use those instead:

explode('/', substr(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH),1)); $_ENV['PATH_INFO'];

But they didnt work too :(

Answer1:

<form action="" method="POST">

that's all

also, there is no point in echoing raw HTML<br /> use this code instead of yours

?> <form action="" method="POST"> <table width="1000" border="1" cellpadding="10" id="navigationBar"> <tr> <td> <a href="/PoliticalForum/Registration.php">Register</a></td> <td> <a href="/PoliticalForum/controlPanel.php">Control Panel</a></td> <td> <a href="/PoliticalForum/checkEmail.php">Donate</a> </td> <td align="right">name:<input name="name" type="text" /></td> <td>password:<input name="pass" type="text" /> <input name="login" type="submit" value="Login" /> </td> </tr> </table> </form>

Answer2:

You can also try:

<form action="<?=$_SERVER['PHP_SELF']?>" method="POST"> <input type="submit" name="form-submit" value="Submit" />

This will cause the form to submit on itself (current page). Use a variable in your form to detect submission or 'regular page load'. E.g.

if (isset($_POST['form-submit'])){ //do stuff }

Recommend

  • Getting a NullPointerException in my Swing Goose class
  • Side effects of handling EVT_PAINT event in wxPython
  • Simple Injector: Different DbContext for selected controllers
  • Is it possible to add PHP scripts in a Java server?
  • Using DI in ConfigureService-Methods (especially IApplicationLifetime) in .NET Core
  • how to submit a form in wordpress
  • Setting initial formfield value from context data in Django class based view
  • A task was canceled
  • Collecting wall posting permission when using the Facebook Registration plugin
  • Image Uploading with AFNetworking 3.0 [closed]
  • android-NestDK stuck with pincode
  • Domain name setup with AWS S3 bucket with static hosting
  • NSOpenPanel's setDirectoryURL doesn't work on Lion
  • Windows Forms switch between Panels
  • Extjs, handling success or failure when doing a standard submit in a form
  • MEF 2: import many
  • Curried UDF - Pyspark
  • pymongo replication secondary readreference not work
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • How to open html table in xls on click of a button
  • how to get username into sql trigger when multiple users signed on from asp membership
  • CodeIgniter URI Parameter is partially bypassing an “if” statement
  • Magento get URL before current
  • How to disable all widgets inside Panel or inside Composite?
  • Simulate click Geckofx vb,net
  • Specifying Castle WCF Integration Facility Endpoint Behavior per Endpoint
  • Installing iPhone App to iPhone
  • Custom validator control occupying space even though display set to dynamic
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • Jquery UI tool tip close icon
  • Nant, Vault & Windows Integrated Authentication
  • HTML download movie download link
  • Bug in WPF DataGrid
  • Upload files with Ajax and Jquery
  • jQuery tmpl and DataLink beta
  • Do I've to free mysql result after storing it?
  • How can I estimate amount of memory left with calling System.gc()?
  • A cron job substitute?
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp