Welcome to WebmasterWorld Guest from 54.196.238.210

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Form variable headache

Getting quotation marks to play nice

     

2oddSox

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

10+ Year Member



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.

g1smd

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

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



Use single quotes for one, and double quotes for the other?

2oddSox

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

10+ Year Member



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

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

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



I just remembered that it worked for me, sometimes.

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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month