Textarea content is not included in $_POST array sometimes, but is at other times.

馋奶兔 提交于 2019-12-04 05:38:30

问题


I have been developing my own CMS for my own website. Just to test out PHP. Anyway, everything was working fine and then all of a sudden I had this problem entering content for articles.

I am using the JQuery markItUp plugin for text editing purposes. It was working and then all of a sudden the main article wouldn't enter into the database.

Here is the form :

 <form action="" method="post" name="action">
                    <tr>
                        <td><label for="title" >Article Title </label></td>
                        <td><input type="text" name="title" class="admintableinput"></td>
                    </tr>
                    <tr>
                        <td><label for="author" > Author </label></td>
                        <td><input type="text" name="author" class="admintableinput"></td>
                    </tr>
                    <tr>
                        <td><label for="summary" > Summary </label></td>
                        <td><textarea name="summary" class="admintableinput"></textarea></td>
                    </tr>
                    <tr>
                        <td><label for="content" >Article Content </label></td>
                        <td><textarea name="content" id="default" class="admintableinput"></textarea></td>
                    </tr>
                    <tr>
                        <td><label for="Category1" > Category </label></td>
                        <td><select name="Category1" id="category1" class="admintableinput">
                            <?php $categories = getCategoryNames();
                            foreach($categories as $category){  ?>
                                <option value="<?php echo "" . $category['id'] . "" ; ?>"><?php echo "" . $category['category'] . "" ; ?></option>
                            <?php } ?>
                        </select></td>
                    </tr>
                    <tr>
                        <td><label for="image" > Image </label></td>
                        <td><input type="text" name="image" class="admintableinput"></td>
                    </tr>
                    <tr>                    
                        <td><input type="submit" name="action" value="Save Article" class="adminbutton" /></td>
                        <td><input type="reset" formnovalidate name="action" value="Reset" class="adminbutton"  /></td>
                    </tr>   
                </table>
            </form>

I have used var_dump($_POST) with and without the plugin. With the plugin var_dump doesn't register the article content and without it it does. It always contains values in every other field.

Does anybody have any idea why this could happen?

I've tried completely removing and adding the plugin again.

Could this be an issue with the textarea?

Any help is appreciated. I don't think this is a PHP issue.


回答1:


It seems that, your javascript does not fill content into the textarea when form submitting.

You should to install an HTTP Debug Proxy named Fiddler to see what had been submitted to PHP script.



来源:https://stackoverflow.com/questions/12240649/textarea-content-is-not-included-in-post-array-sometimes-but-is-at-other-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!