Forum Moderators: coopster

Message Too Old, No Replies

Pass the control from Bot to Browser

         

kamal33

11:49 am on Feb 14, 2012 (gmt 0)

10+ Year Member



Hi All,

Is it possible in PHP/Perl to process a part of the form filling using a program (script) and after the first pass or so pass the control back to the user. Any such library in Perl/PHP?

For e.g. most of the fields of email registration at an email provider site are filled by Bot, then the user gets a page on the browser with those fields filled and needs to may be enter just one or two sensitive informations left.


Tight on deadline for a client. Any help would be really appreciated.

Best Regards
Kamal

penders

12:29 pm on Feb 14, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If it is possible to auto-complete certain fields then it would be usual to complete these elements as you build the form (and page) before serving it to the client. Is this not your intention? Do you not have control over the form?

kamal33

1:01 pm on Feb 14, 2012 (gmt 0)

10+ Year Member



Thanks for the reply.

No, the autocomplete is not required.

The form needs to be filled from say some database using PHP script, then the control needs to be given to UI-based browser to do some manual stuff.


Thanks
Best Regards
Kamal

rocknbil

4:23 pm on Feb 14, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



// To squelch undefined variable warnings if no record found
$user = null;
$query = "select username from users where id=$id";
$result = mysql_query($query);
if ($row = mysql_result($result)) { $user = $row['username']; } // or $row[0], in this case

echo '<p><label for="username">User Name:</label> <input type="text" name="username" id="username" value="' . $user . '"></p>';

... then update the record on submit, it will user whatever is in the database on the next page. If you don't want this value edited on the next page,

$user = null;
$step = (isset($_POST['username']) and ! empty($_POST['username'))?1:2;
// if 1, update or insert HERE

$query = "select username from users where id=$id";
$result = mysql_query($query);
if ($row = mysql_result($result) { $user = $row['username']; } // or $row[0], in this case

if ($step==2) {
echo "<p><strong>User Name:</strong> $user </p>";
}

else {
echo '<p><label for="username">User Name:</label> <input type="text" name="username" id="username" value="' . $user . '"></p>';
}

A simplified example as you'd also use the step and username combination as an error handler, but that's the idea.