<?php
if (isset($_POST['generate'])) {
$charset = 'absdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ0123456789%$#-()*&.,';
$generated_password = substr (str_shufle($charset),0, 12);

}
?>
<form action ="password generator" method="post">
<input type="submit" name="generator" value="Generate"><input type="text" value="<?php if (isset($generated_password)) {echo $generated_password; } ?>"/>
</form>

when i click in generate button it show me this:

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

localhost
Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.4

Recommended Answers

All 6 Replies

Member Avatar for diafol

Try a better title for your question. And it's 'shuffle'

it is the same bro i have done it

This doesn't do anything:

<form action ="password generator" method="post">

It needs to be a proper file path, like:

<form action ="password-generator.php" method="post">

Yes, the problem is in your form action tag, leave it blank or use your desired page.

Try this

<?php
if (isset($_POST['generator'])) {
$charset = 'absdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ0123456789%$#-()*&.,';
$generated_password = substr (str_shuffle($charset),0, 12);
}
?>
<form action ="" method="post">
<input type="submit" name="generator" value="Generate"><input type="text" value="<?php if (isset($generated_password)) {echo $generated_password; } ?>"/>
</form>
commented: This will exactly what andyy121 need :) +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.