Jump to content

$_POST[] while using a class and a name in the <tag>


Recommended Posts

I installed codepress for a code editor im creating. the problem is after installing it my $_POST['data'] stopped working

 

this doesnt work

<form method="post">
<textarea onkeydown="return catchTab(this,event)" rows="50" id="myCpWindow" class="codepress '.$extension.'"  wrap="off" name="'.$pass.'">'.$contents.'</textarea>
<input type="submit" value="save" name="save">                 
</form>
<?php
                                if(isset($_POST['save'])){//if user has selected save

                                        if(isset($_POST[$pass])){

                                                $contentsdec=htmlspecialchars_decode(stripslashes($_POST[$pass]));

                                                if(e_wwrite($file, $contentsdec)){

                                                        echo "
                                                        <br />saved file: $file
                                                        ";

                                                }else{

                                                        echo "
                                                        error Saving, Recommend you copy your work onto a file on your computer and contact support
                                                        ";
                                                }

                                        }else{

                                                echo "
                                                        error retrieving data from saved file
                                                ";

                                        }

                                }

?>

and this does

 

<form method="post">
<textarea onkeydown="return catchTab(this,event)" rows="50" id="myCpWindow"  wrap="off" name="'.$pass.'">'.$contents.'</textarea>
<input type="submit" value="save" name="save">                 
</form>
<?php
                                if(isset($_POST['save'])){//if user has selected save

                                        if(isset($_POST[$pass])){

                                                $contentsdec=htmlspecialchars_decode(stripslashes($_POST[$pass]));

                                                if(e_wwrite($file, $contentsdec)){

                                                        echo "
                                                        <br />saved file: $file
                                                        ";

                                                }else{

                                                        echo "
                                                        error Saving, Recommend you copy your work onto a file on your computer and contact support
                                                        ";
                                                }

                                        }else{

                                                echo "
                                                        error retrieving data from saved file
                                                ";

                                        }

                                }

?>

 

the only difference is the class='' so im kinda guess that using a name and a class element in a tag doesnt work? But i need to have both, so im not sure it to do this.

In the form section you are outside of PHP, not sure how it ever worked to be honest.

 

<form method="post">
<textarea onkeydown="return catchTab(this,event)" rows="50" id="myCpWindow" class="codepress <?php echo $extension;?>"  wrap="off" name="<?php echo $pass;?>"><?php echo $contents; ?></textarea>
<input type="submit" value="save" name="save">                 
</form>

 

Try that and see if it works.

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.