Jump to content

form input is not getting through


Togfather
Go to solution Solved by Togfather,

Recommended Posts

Hello,

 

I hope this is the right place for my question. I am new to php, having spent more than a decade writing in vbscript for asp pages, and I am stumped by this problem. I have searched both of my PHP manuals, the net and forums galore but cannot find the answer.

 

I am trying to display records from mysql with a button to delete each record in the display. However, when I press the button, the information does not get through to the manipulation page.

 

In the first page my relevant code is:        

 

   <form action="<?=$_SERVER[ 'PHP_SELF' ] ?>" method="post">           <input type="hidden" name="ident" value="<? echo $row[0];?>">

           <input type="submit" value="Delete"></form>
 

 

$row [0] is the auto incrementing ID field and in this instance I have checked that it contains a value, which is the integer 3.
 
Now when I get to the next page, which is supposed to delete the record, I do not get any errors, but nothing happens, so I wrote the following code to check that the information had been passed through.    

 

  <?php

         $id = (INT)$_post['ident'];
         echo 'Form input= ', $_post['ident'], '<br>';
         echo '$id= ', $id, '<br>';
 

 

 
This produces
input=
$id= 0
 
when it should produce
input = 3
$id= 3
 
Once I can get the production of an integer in the $id variable I will be able to delete the record from the database.
 
Can anyone tell me what I have done wrong please?
 
Many thanks in advance.
Link to comment
Share on other sites

  • Solution

OK I have fixed it now.

 

I was forgetting that the $_POST function is case sensitive and used lower case.

 

Upper casing it has fixed the problem. I spent days pondering this too - just shows that I am getting old :-)

 

Regards

 

Tog

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.