Welcome to WebmasterWorld Guest from 220.127.116.11 , register , login , search , subscribe , help , library , PubCon , announcements , recent posts , open posts Subscribe to WebmasterWorld
Form variable headache Getting quotation marks to play nice 2oddSox msg:3756543 12:43 pm on Oct 1, 2008 (gmt 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!
g1smd msg:3756545 12:46 pm on Oct 1, 2008 (gmt 0)
Use single quotes for one, and double quotes for the other? 2oddSox msg:3756546 12:54 pm on Oct 1, 2008 (gmt 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.
g1smd msg:3756551 12:56 pm on Oct 1, 2008 (gmt 0)
I just remembered that it worked for me, sometimes.
Purists would probably look more into what you 'escape' and how you do it.