Jump to content

stuck on POST reading


Go to solution Solved by jac.kock,

Recommended Posts

how can help me to get the post in my code i been try'ng for days:(

 

my code:

<?php
if($_POST['Submit'])
{
       echo "Submit here";
}
if($_POST['del'])
{
       echo "del here";
}
if($_POST['add'])
{
        echo "add here";
}

?>

<table width="100%" align="top" border="1">
  <tr>
    <td align="top" valign="top">

       <!-- START: profile photo and options -->
       <table width="100%">
          <tr>
            <td align="center" valign="center">
               <img src="upload/users/<?=$x['user_photo'];?>" width="140px" height="187px" alt="<?=$x['user_name'];?>" />
            </td>
         </tr>
         <tr>
           <td align="top" valign="left">
              <form name="proinfo" action="?<?=$_SERVER['QUERY_STRING'];?>" method="post" enctype="multipart/form-data">
              <input type="hidden" id="abuseid" name="abuseid" value="<?=$x['user_id'];?>"/> 
              <input type="hidden" id="fromid" name="fromid" value="<?=$log['user_id'];?>"/> 
              <input name="abuse" type="image" id="abuse" value="Submit" src="modules/community/abuse.png" alt="" width="20" height="20" border="0" align="absmiddle"> report<br />
              <input name="add" type="image" id="add" value="add" src="modules/community/abuse.png" alt="" width="20" height="20" border="0" align="absmiddle"> add<br />
              <input name="del" type="image" id="del" value="del" src="modules/community/abuse.png" alt="" width="20" height="20" border="0" align="absmiddle"> del<br />

               </form>
           </td>
        </tr>
     </table>
     <!-- END: profile photo and options -->

    </td>
  </tr>
</table>

i can't seem to get the post what am i doing wrong? pls help

Link to comment
https://forums.phpfreaks.com/topic/283371-stuck-on-post-reading/
Share on other sites

Your method of testing is wrong... you are testing the value of the POST not that it is set,

 

Change these:

if($_POST['Submit']){}

to

if(isset($_POST['Submit'])){}

 

also not sure your form is right either since all buttons / img-buttons are in the same form???

Your method of testing is wrong... you are testing the value of the POST not that it is set, Change these:

if($_POST['Submit']){}
to
if(isset($_POST['Submit'])){}
also not sure your form is right either since all buttons / img-buttons are in the same form???

 

 

 hi, i want to use 1 form for more options so i have named them differant. I wnat to review the POST to see witch action must be taken there exp:

 

if del then del_user

if add then add_user

if abuse then abuse_report

 

do you know what i mean? can you help me to get the right steps?

If you're using an image as the submit button some browsers only send the X,Y coords for where the user clicked the button. So you'll want to check for this too

<?php
if(isset($_POST['abuse']) || isset($_POST['abuse_x']))
{
       echo "Submit here";
}
if(isset($_POST['del']) || isset($_POST['del_x']))
{
       echo "del here";
}
if(isset($_POST['add']) || isset($_POST['add_x']))
{
        echo "add here";
}

?>
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.