problem with setting variables

Hi all,
noob here,
I’ve been trying to manipulate this bit of code to do what I want, but for 2 days it’s been driving me nuts.

So I want to set a variable $vi to value that is set from a form the_field(‘view_image’).

[php]

<?php $vi=the_field('view_image'); if ($vi==1) echo 'blabla'; ?>

[/php]

The output I keep getting is 1, when it should be blabla

Please help, it’s probably something really simple and stupid, but I can’t seem to work it out.

Hi Matt,

To retrieve a value from a form, just call $_POST or $_GET (depending on the method declared in your form) plus [‘textfield name’].

<?php
$vi=$_POST['the_field'];
if ($vi==1){
echo "Blaah...";
}
?>
Sponsor our Newsletter | Privacy Policy | Terms of Service