#16
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    21
    Rep Power
    0
    No...
  2. #17
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    21
    Rep Power
    0
    Th issue with the textarea is ok now.
    But I still have the problem with the backslashes...
  4. #18
  5. hiding my <b> from ur <strong>
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2004
    Posts
    959
    Rep Power
    181
    If you're unable to turn magic quotes off (because you're on shared hosting and can't reset the server), you may have to use stripslashes() to eventually accomplish what you need.
    ****
    Enjoy my post? Drop some props by hitting the scales button up top. JBL

    Website Design in Los Angeles and Washington, DC by PoweredPages.com
  6. #19
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    21
    Rep Power
    0
    Originally Posted by daprezjer
    If you're unable to turn magic quotes off (because you're on shared hosting and can't reset the server), you may have to use stripslashes() to eventually accomplish what you need.
    But in my phpinfo here:

    http://www.articles4less. com/phpinfo.php

    It is written that magic quotes is off...
  8. #20
  9. hiding my <b> from ur <strong>
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2004
    Posts
    959
    Rep Power
    181
    Then there's obviously something in your code that is adding the slashes upon input. Perhaps if you pasted in more of your code, specifically, that which inputs the values into the database, we could see.

    But that's a bit beside the point. I showed you how to remove the slashes, no matter how they got in there in the first place.
    ****
    Enjoy my post? Drop some props by hitting the scales button up top. JBL

    Website Design in Los Angeles and Washington, DC by PoweredPages.com
  10. #21
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    21
    Rep Power
    0
    Originally Posted by daprezjer
    Then there's obviously something in your code that is adding the slashes upon input. Perhaps if you pasted in more of your code, specifically, that which inputs the values into the database, we could see.

    But that's a bit beside the point. I showed you how to remove the slashes, no matter how they got in there in the first place.
    Here is, as an example, the code of the "Guidelines" field (in the order page):

    Code:
    <div style="padding:15px 0 0 0">General Guidelines for All Articles: (optional)<br/> <textarea id="comments" name="comments" class="mywidth" rows="2" cols="53"><?php
    if (isset($articleDetails['comments']) && $articleDetails['comments'] != NULL)
    echo $articleDetails['comments']; ?></textarea> <br/></div>
    And here is the relevant code in next page (Shopping Cart):

    Code:
    $articleDetails['comments'] = $_POST['comments'];
    Also, how do I use stripslashes() in this code?

    Thanks!
  12. #22
  13. hiding my <b> from ur <strong>
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2004
    Posts
    959
    Rep Power
    181
    Look up the php documentation for stripslashes. But generally, you just put whatever text you want to strip the slashes from inside the parentheses. So on your one page that grabs the POST:

    stripslashes($_POST['comments'])
    ****
    Enjoy my post? Drop some props by hitting the scales button up top. JBL

    Website Design in Los Angeles and Washington, DC by PoweredPages.com
  14. #23
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    21
    Rep Power
    0
    Thank you! It works now. But I tried to do the same thing with the other 2 fields (Subject + Keywords):

    Code:
    $articleDetails['comments'] = stripslashes($_POST['comments']);
    $articleDetails['articlenames'] = stripslashes($_POST['articlename']);
    $articleDetails['articlekeywords'] = stripslashes($_POST['articlekeyword']);
    But it doesn't work.

    These fields are: input type="text"
    and not "textarea"
    Is this the reason?
  16. #24
  17. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,692
    Rep Power
    6351
    Define "doesn't work"

    Actually, scratch that, your variable names are wrong.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  18. #25
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    21
    Rep Power
    0
    What do you mean the variable names are wrong?

    You can test the process on a different site that has the same code: yeparticles.com/order

    I added the stripslashes to the 3 variables and you can see that you will get a line with the letter A.
  20. #26
  21. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,692
    Rep Power
    6351
    I mean:

    $articleDetails['articlenames'] = stripslashes($_POST['articlename']);
    $articleDetails['articlekeywords'] = stripslashes($_POST['articlekeyword']);
    your variables are wrong.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  22. #27
  23. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    21
    Rep Power
    0
    But it doesn't matter, since these are the variable names in the Order page too.

    Anyway, I tried to change it, but I had the same problem again... (with the A)
  24. #28
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    21
    Rep Power
    0
    Here is the code of those variables in the Order page:

    Code:
    <tr>
    <td><label class="slno" id="slno<?php echo $i + 1; ?>"><?php echo $i + 1; ?></label></td>
    <td><input type="text"  style="width: 400px;" class="aname" name="articlename[]" id="articlename<?php echo $i + 1; ?>" value="<?php echo $articleDetails['articlenames'][$i]; ?>"/></td>
    <td><input type="text" maxlength="4" style="width: 95px;" class="wname" name="wordnum[]" id="wordnum<?php echo $i + 1; ?>" value="<?php echo $articleDetails['wordnums'][$i]; ?>"/></td>
    <td><input type="text"  style="width: 300px;" class="kname" name="articlekeyword[]" id="articlekeyword<?php echo $i + 1; ?>" value="<?php echo $articleDetails['articlekeywords'][$i]; ?>"/></td>
    <td class="delete" style="width:16px;" valign="middle">
    <img style="cursor:pointer; margin: 0;" class="delete_img" id="delete<?php echo $i + 1; ?>" src="<?php bloginfo('template_directory') ?>/images/cart/delete.jpg"/>
    </td>
    </tr>
    Thanks!!
  26. #29
  27. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    21
    Rep Power
    0
    I think that the problem is that the form as set up uses arrays for articlename and articlekeyword so I can't apply stripslashes to the array. So how can I apply the function to each individual element in the array?
  28. #30
  29. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,692
    Rep Power
    6351
    array_walk
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo