[eluser]ranjitbd[/eluser]
Code:
<html>
<head>
<title><?php echo "Test Form";?></title>
</head>
<body>
<?php echo form_open('form'); ?>
// a simple registration form.....................
<h5>Username</h5>
<?php echo form_error('username'); ?> // it is for showing error individually ....
<input type="text" name="username" value="<?= set_value('username')?>" size="50" />
// here set_value to remain the user input value.......
<h5>Password</h5>
<?php echo form_error('password'); ?>
<input type="text" name="password" value="<?= set_value('password')?>" size="50" />
<h5>Password Confirm</h5>
<?php echo form_error('passconf'); ?>
<input type="text" name="passconf" value="<?= set_value('passconf')?>" size="50" />
<h5>Email Address</h5>
<?php echo form_error('email'); ?>
<input type="text" name="email" value="<?= set_value('email')?>" size="50" />
<div><br /><input type="submit" value="Submit" /></div>
<?php
$end_tag = '</body></html>';
echo form_close($end_tag);
?>
//// if i use a student info form for editing instead of registration i need to show value from databases. for that i can use value="<? echo $Studentname?>". showing below..
// imagine that it is a student form for showing list of student and edit student
[code]
<html>
<head>
<title><?php echo "student form";?></title>
</head>
<body>
<?php echo form_open('form'); ?>
<h5>Studentrname</h5>
<?php echo form_error('studentrname'); ?> // it is for showing error individually ....
<input type="text" name="studentrname" value="<?= $studentrname;?>" size="50" />
// here i used $studentrname for showing the name from database for editing.
// here how i use the set_value method to remain the username if update fails
// suppose the user click update and change the name..but few input field is blank
// and failed update for form_validation...
// my question is i want to show the user info already given for update..thats why i need set_value function...but how can i use it.
<h5>Address</h5>
<?php echo form_error('address'); ?>
<input type="text" name="address" value="<?= set_value($address)?>" size="50" />
// <?= set_value($address)?> ............is it correct?
<h5>Class</h5>
<?php echo form_error('class'); ?>
<input type="text" name="class" value="<?= $class ?>" size="50" />
<h5>Email Address</h5>
<?php echo form_error('email'); ?>
<input type="text" name="email" value="<?= $email?>" size="50" />
<div><br /><input type="submit" value="Submit" /></div>
<?php
$end_tag = '</body></html>';
echo form_close($end_tag);
?>
// all the question is commented by '//' in the coding
// plz help