Jump to content

stuck on POST reading


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

 

 

 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";
}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.