The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
access to @fields[] via api - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: access to @fields[] via api (/showthread.php?tid=2453) |
access to @fields[] via api - criley645 - Jun 9th, 2013 Hello everyone, I'm a real newbie to formtools but it seems like a great product. I have a single page form where I'm trying to calculate a md5 from the value stored in the email field and write it in the database. I saw in examples in the tutorials where you could access these fields via the @$field hash. e.g. <td><input type="text" name="email" value="<?php htmlspecialchars(@$fields["email"])?>" size="100"> This seems to work file. What I'd like to do is: <?php $str=@$fields["email"]; $md5Str = md5($str); echo "<input type=hidden name=encrypted_email value=$md5Str />\n"; ?> What gets stored in the database in the encrypted_email field is a "/" so I'm not quite sure what is going on. Any Ideas would be appreciated! Thanks in advance, Chris RE: access to @fields[] via api - criley645 - Jun 14th, 2013 (Jun 9th, 2013, 1:19 PM)criley645 Wrote: Hello everyone, I've resolved this issue by updating the $_POST hash once the form was submitted. Because this is server side processing, the only way you can get access to the values of the fields prior to POST is with javascript and I didn't want to go down that road. I didn't need any dynamic functionality so server side processing worked fine for me. here is a code snippet if anyone can find it useful. if (isset($_POST["submit"])) { // Add encrypted email to the field set $_POST["encrypted_email"]=md5($_POST['email']); // RE: access to @fields[] via api - Joe - Jun 18th, 2013 Awesome! Thanks for posting this. Cheers, Joe |