Welcome Guest, Not a member yet? Register   Sign In
Prepopulating form data
#6

[eluser]TheFuzzy0ne[/eluser]
Here's some untested HTML which might give you some inspiration, but as JayTee said, it's not really an "easy" way:
Code:
<html>
    <head>
        <title><?php echo (isset($id)) ? "Edit" : "Add" ; ?>User</title>
    </head>
    <body>
        <form action="/user/<?php echo ($id) ? 'edit' : 'add'; ?>" method="post">
            <input type="type" name="username" value="<?php echo (isset($username)) ? $username : ''; ?>" />
            <?php if (isset($id)): ?>
            <input type="hidden" name="id" value="<?php echo $id; ?>" />
            <?php endif; ?>
        </form>
    </body>
</html>

Basically, the rule is, if an id is specified, then the user obviously exists, therefore we must be editing. If not, we're adding. Simple, huh?


Messages In This Thread
Prepopulating form data - by El Forum - 02-09-2009, 06:02 PM
Prepopulating form data - by El Forum - 02-09-2009, 06:16 PM
Prepopulating form data - by El Forum - 03-02-2009, 04:39 PM
Prepopulating form data - by El Forum - 03-02-2009, 06:08 PM
Prepopulating form data - by El Forum - 03-02-2009, 07:56 PM
Prepopulating form data - by El Forum - 03-02-2009, 08:10 PM
Prepopulating form data - by El Forum - 03-06-2009, 05:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB