CodeIgniter Forums
POSTING hidden values - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: POSTING hidden values (/showthread.php?tid=78178)



POSTING hidden values - richb201 - 12-09-2020

In my form I am setting these hidden values

<input type="hidden"  name="email"        value=<?php $emailString?>/>
<input type="hidden" name="campaign"  value=<?php $campaignString?>/>
<input type="hidden" name="taxyear"    value=<?php $dateString?> />



and then I submit it to  a function in the controller. This is the code that runs in the controller

$campaign=$_POST["campaign"];
$email=$_POST["email"];
$taxyear=$_POST["taxyear"];


But when I take a look at $campaign, $email, and $taxyear , once the form is submitted, they are all "/".  Why? 


RE: POSTING hidden values - InsiteFX - 12-09-2020

Maybe because the value is in double quotes.
value=""


RE: POSTING hidden values - sammyskills - 12-10-2020

You can try something like this:

Code:
<input type="hidden" name="email" value="<?php $emailString?>">

Enclose the php code in double quotes.


RE: POSTING hidden values - vitnibel - 12-10-2020

just need to add echo, like this

PHP Code:
<input type="hidden" name="email" value="<?php echo $emailString ?>"



RE: POSTING hidden values - richb201 - 12-10-2020

Thanks. The suggestions worked perfectly.