1

hi im trying to set up my website. Initial php works very vell. I can get select value from db. When i click submit button im getting

Forbidden

You don't have permission to access / on this server.

error. Submit button usses POST $_SERVER['REQUEST_URI'] and it going same php and add/changes values inside tinymce rich text box as bellow code.

<script language="javascript" type="text/javascript">
function initMCEexact(e){   
     tinyMCE.init({
        theme : "advanced",
        mode: "exact",
        elements : e,
        theme_advanced_toolbar_location : "top",
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,"
        + "justifyleft,justifycenter,justifyright,justifyfull,formatselect,"
        + "bullist,numlist,outdent,indent,preview,print",
        theme_advanced_buttons2 : "link,unlink,anchor,image,separator,"
        +"undo,redo,cleanup,code,separator,sub,sup,charmap",
        theme_advanced_buttons3 : "",

        height:"800px",
        width:"100%",
         plugins: "print,preview",
        toolbar: "print,preview"

    });
}
initMCEexact("elm1");
</script>

<form method="post" action="<?=$_SERVER['REQUEST_URI']?>">
  <textarea id="elm1" name="elm1" rows="15" cols="80" width="100%"><?php echo $sContent;?></textarea>

<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>

and it post side of form

if(isset($_POST['elm1']) || isset($_POST["btn-upload"])) {
if(isset($_SESSION['sContent'])){
    $sContent=$_SESSION['sContent'];
}  
$sContent = strip_tags(stripslashes($_POST['elm1']),$allowedTags);
if(isset($_SESSION['id']) && isset($_SESSION['name'])){
$sql="INSERT INTO kopru (kopruid, kopruadi, html) VALUES('$kopruid', '$kopruname', '$sContent') ON DUPLICATE KEY UPDATE kopruadi=VALUES(kopruadi), html=VALUES(html)";
    mysqli_query($conn,$sql);
}
if(isset($_SESSION['sContent'])){
    $_SESSION['sContent']=$sContent;
}   

}

It works on local wamp server very well.

im using cpanel as panel.

Furkan
  • 141
  • 1
  • 13
  • 1
    You don't have to specify action attribute of from tag if you want it to be passed to the same url as current. And look at this question (looks like the same issue): http://stackoverflow.com/questions/4341548/403-forbidden-on-form-submission. – Alex Nov 06 '15 at 08:33
  • And here is one more: http://stackoverflow.com/questions/8824511/forbidden-error-when-submitting-simple-php-form. – Alex Nov 06 '15 at 08:34
  • I normally can submit forms but in that specific form it gives me forbidden error. – Furkan Nov 06 '15 at 09:23

0 Answers0