Jump to content

Recommended Posts

Ok I have yet another frustrating problem.. I don't know if its with the host I have (Godaddy) or if its with the code..

 

What I have is a form, with a confirmation page. We all know the use of a confirmation page. Double Check and go back and edit if need be. Well anyway I have a multi-line text area for a message body.. Now what I want from that particular part is the ability on the confirmation page to have it echo the submitted data. Which that parts not hard part.. Its replacing quotation marks (double and or single) its replacing \n with <br> just for the sake of displaying it nicely..

 

Now I used to use

 

$optional_comment2 = ereg_replace("\\\'","'",$optional_comment2);
$optional_comment2 = ereg_replace("\n","<br>\n",$optional_comment2);
$optional_comment2 = ereg_replace("\"",""",$optional_comment2);[\code]

along with similar in concept.. and this used to work on previous host's I have had.. worked like a charm.. 
again I don't know if its a me thing and I was just getting lucky in the past or its a godaddy thing, I have PHP 4.0.32 I belive on my godaddy server.

I dunno, anyone got idea's? What am I doing wrong or yea..



Link to comment
https://forums.phpfreaks.com/topic/84226-solved-replacement-of/
Share on other sites

if your hosting on the windows hosting at godaddy the php is run in strict safe mode. I know this much I made this mistake a while back. So if you are thats more than likley your isssue. I suggest you switch to their linux hosting unless your relying on .asp for some reason or another. In that case the joke is on you.

Link to comment
https://forums.phpfreaks.com/topic/84226-solved-replacement-of/#findComment-428900
Share on other sites

Its godaddy, linux based...

 

 

The question is can anyone tell me from my code above what i might be doing wrong.. in the case where I want to remove the quotation marks, and put something more code friendly per say

 

replacing " with " for example..

Link to comment
https://forums.phpfreaks.com/topic/84226-solved-replacement-of/#findComment-428908
Share on other sites

 

First:

 

Use str_replace(), it's far less intensive (cpu-wise)compared to ereg_replace()

 

Second:

 

Switch your GD account to PHP5 - no reason at all to continue with PHP4.x. You can do that in your control panel under Languages

 

I tried your code on my own test site with GD and had no problems.

 

Some changes:

$optional_comment2 = str_replace("\\\'","'",$optional_comment2); //Where are you getting the triple \'s from?
$optional_comment2 = str_replace("\n","<br />\n",$optional_comment2);
$optional_comment2 = str_replace('"',""",$optional_comment2);

Link to comment
https://forums.phpfreaks.com/topic/84226-solved-replacement-of/#findComment-428938
Share on other sites

Hey there I just tried it and works perfectly, if I di it to way I am sure you said.

 

It breaks a line when you press enter and when you submit it echo it the way you typed it out

 

<?
$optional_comment2 = ereg_replace("\\\'","'",$optional_comment2);
$optional_comment2 = ereg_replace("\n","<br>\n",$optional_comment2);
$optional_comment2 = ereg_replace("\"",""",$optional_comment2);


echo $optional_comment2
?><form action="" action="get">
<textarea name="optional_comment2"></textarea>
<input type="submit" value="Submit">
</form>

Link to comment
https://forums.phpfreaks.com/topic/84226-solved-replacement-of/#findComment-428939
Share on other sites

Ahh found part of my problem.. I didn't realize it before but it was magic quotes, kinda new with magic quotes but after playing with it I got my disired output.. however a new problem has arised... Which is fine, Im gonna have to tinker with it a bit but Im sure I can get my ultimate disired end result out of it. I just wanted to say thanks yet again to all who have posted in reply..

Link to comment
https://forums.phpfreaks.com/topic/84226-solved-replacement-of/#findComment-432198
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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