Jump to content

Syntax Question, Variable inside of $_POST


carlg

Recommended Posts

delimiting the $row['myfield'] with single quotes will not work as you want.

 

Single quotes do not parse variable info. Use double quotes or without quotes:

 

<?php
// any one above will work:
$_POST[$row['myfield']]; // with no quotes
$_POST["{$row['myfield']}"]; // with double quotes and variable delimiter
$_POST["$row[myfield]"]; // this also work but is not recommended
?>

 

quotes are used to delimite strings. the double quotes let you put variables inside. the single quotes assumes the string "as it is"... back quotes is "another history".

 

take a look in php doc at www.php.com about strings and array keys.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.