Welcome to WebmasterWorld Guest from 54.163.49.19

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Form variable headache

Getting quotation marks to play nice

     
12:43 pm on Oct 1, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:Mar 1, 2003
posts:533
votes: 0


Any help here would be appreciated.

In simple terms, I have a bunch of variables sent from a form on page1.

Page2 grabs these variables, and concatenates them like so:

$newstring = var1.var2."\"".$2wordvar."\"".var3;

$2wordvar needs to be enclosed in quotation marks. The idea then being to have $newstring as a form input variable like so:

<input type="text" name="title" value="<?php echo $newstring ?> " />

An example output would be:

23 57 "Hello World" 17

If I echo out the result it works perfectly, but not when I try to get it to populate the input field. It always stops where the first quotation mark would occur (in other words, in the case above only '23' would be output) or just omits the whole variable totally. For the record, magic quotes is enabled if that has anything to do with it.

Can anyone shed some light on this? It seems such a simple thing but it's driving me nuts!

Many thanks.

12:46 pm on Oct 1, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Use single quotes for one, and double quotes for the other?
12:54 pm on Oct 1, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:Mar 1, 2003
posts:533
votes: 0


You have got to be flamin' kidding me. Seriously mate, that worked perfectly.

Grr, I've spent untold hours on this and it's been like pushing a bubble under wallpaper.

You're a champion g1. Many, many thanks.

12:56 pm on Oct 1, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


I just remembered that it worked for me, sometimes.

Purists would probably look more into what you 'escape' and how you do it.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members