Steven Matthews
Steven Matthews

Reputation: 11285

Variable assignment and functions - this should work right?

I am trying to take a variable from $_POST, run mysql_real_escape_string and a custom function, html2text on it. This should work, right? Or do I need to separate it on separate lines?

$orgname = mysql_real_escape_string(html2txt($orgname)) = $_POST['orgname'];

Upvotes: 0

Views: 38

Answers (2)

ComFreek
ComFreek

Reputation: 29424

That won't work because you can't use the functions return value in write context:

Fatal error: Can't use function return value in write context

This code should work (and is more cleaner):

$orgname = mysql_real_escape_string( html2txt($_POST['orgname']) );

Upvotes: 1

Joe
Joe

Reputation: 82594

Are you trying to do this:

$orgname = mysql_real_escape_string(html2txt($_POST['orgname']));

Upvotes: 3

Related Questions