T_ENCAPSED_AND_WHITESPACE errors[solved]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shivam0101
Forum Contributor
Posts: 197
Joined: Sat Jun 09, 2007 12:09 am

T_ENCAPSED_AND_WHITESPACE errors[solved]

Post by shivam0101 »

Code: Select all

$form_url=\".$_SERVER['PHP_SELF'].?process=edit"\;
I am getting error, parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
Last edited by shivam0101 on Sat Sep 15, 2007 12:36 pm, edited 1 time in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Code: Select all

<?php
$x = $arr['index'];
// but
$x = "... $arr[index] ...";
// or
$x = "... {$arr['index']} ...";
see also:
http://de2.php.net/language.types.string
http://de2.php.net/language.types.array
jeffery
Forum Contributor
Posts: 105
Joined: Mon Apr 03, 2006 3:13 am
Location: Melbourne, Australia
Contact:

Post by jeffery »

so the correct way to write it is:

Code: Select all

$form_url = $_SERVER['PHP_SELF'] . '?process=edit';
or

Code: Select all

$form_url = "{$_SERVER['PHP_SELF']}?process=edit";
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

....or avoiding the use of PHP_SELF entirely, since it contains user input.
Post Reply