homepage Welcome to WebmasterWorld Guest from 54.205.105.23
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Form variable headache
Getting quotation marks to play nice
2oddSox

10+ Year Member



 
Msg#: 3756541 posted 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!

Many thanks.

 

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3756541 posted 12:46 pm on Oct 1, 2008 (gmt 0)

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

2oddSox

10+ Year Member



 
Msg#: 3756541 posted 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

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3756541 posted 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved