rygonet Posted May 11, 2007 Share Posted May 11, 2007 Okay, so I have: <input type="hidden" name="__FIELDPUT" id="__FIELDPUT" value="/abunchofrandomnumbersandvarshere" /> How do I put "abunchofrandomnumbersandvarshere" in a variable? Here's what I got so far (by the way, abunchofrandomnumbersandvarshere is random and can be anything). if(preg_match("/id=\"__FIELDPUT\" value=\"(.*)\" /s", $html, $matches)) { $viewstate = $matches[1]; } echo $fieldput; I know this is wrong.. Quote Link to comment Share on other sites More sharing options...
chigley Posted May 11, 2007 Share Posted May 11, 2007 If that form's method is POST, just use $_POST['__FIELDPUT'] to get the value of it in PHP. Quote Link to comment Share on other sites More sharing options...
effigy Posted May 11, 2007 Share Posted May 11, 2007 <pre> <?php $html = '<input type="hidden" name="__FIELDPUT" id="__FIELDPUT" value="/abunchofrandomnumbersandvarshere" />'; if(preg_match('/(?<=id="__FIELDPUT" value=")([^"]*)/', $html, $matches)) { print_r($matches); $var = $matches[1]; } echo $var; ?> </pre> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.