Welcome to Dream.In.Code
Click Here
Getting PHP Help is Easy!

Join 117,543 PHP Programmers for FREE! Ask your question and get quick answers from experts. There are 1,749 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



inserting password into the table

 
Reply to this topicStart new topic

inserting password into the table, the problem which i face is that when i press the save button

msvp4u
post 22 Jul, 2008 - 02:24 PM
Post #1


New D.I.C Head

*
Joined: 15 Jul, 2008
Posts: 37


My Contributions


the problem which i face is that when i press the save button


CODE

<select name=seluser class=NormalFont >

<option value="0">-Select User from List-</option>                                                               <?php while ($row = mysql_fetch_array($result)) {
$username = $row["username"];
?>                  

<option value =" <?php echo $row['usrid']; ?>"><?php echo "$username";?></option>
<?php
}
?>            
</option>
</select>

</td>
<?php
$use = $_POST['seluser'];                
$pass = $_POST['txtpass'];
$confpass = $_POST['txtconfpass'];
$psql = "INSERT INTO loginuser VALUES ('usrid=\"$use\"','','','','$pass','$confpass');";
$presult = mysql_query($psql)or die(mysql_error());            
?>
Password<input type="password" name="txtpass" size="25" class="NormalTextBox" value="" maxlength=20>
Comfirm Password<input type="password" name="txtconfpass" size="25" class="NormalTextBox" value=""  maxlength=20>
<input type="button" class="NormalButton"  value=" Save " onClick="doSubmit(edituser)" id=button1 name=button1>
<input type="button" class="NormalButton" value=" Cancel " onClick="java script:location.href = './users.php'" id=button2 name=button2>


<script language="javascript">

       function IsEmpty(MyValue)

        {

            if (MyValue.replace(/\s+/g,"").length<=0)

            {

                return true;

            }

            else

            {

                return false;

            }

        }

        

        function doSubmit(form)

        {

        if(form.seluser.selectedIndex == 0 )

            {

                alert("Select the user name");

                form.seluser.focus();        

            }        

        else if (IsEmpty(form.txtpass.value))

            {

                alert("Enter the Password");

                form.txtpass.focus();

            }

            else if (IsEmpty(form.txtconfpass.value))

            {

                alert("Enter the Confirm Password");

                form.txtconfpass.focus();

            }

            else if (form.txtpass.value != form.txtconfpass.value)

            {

                alert("Mismatch of Password and Confirm Password");

                form.password.focus();

            }    

            else

            {

                form.flag.value = "1";

                form.action = "./edituser.php";

                form.submit();

            }

        }    

        function Seluser(frm)

        {

            if(frm.seluser.selectedIndex == 0 )

            {            

            }                        

            else

            {

            frm.flag.value = "2";

            frm.action = "./edituser.php";

            frm.submit();

            }

        }

   </script>




<u>My Table</u>
table name:loginuser
fields
1.usrid
2.fname
3.lname
4.usrname
5.pass
6.confpass

in the table the value is getting updated twice with a new usrid
User is offlineProfile CardPM

Go to the top of the page


JBrace1990
post 22 Jul, 2008 - 03:24 PM
Post #2


D.I.C Regular

Group Icon
Joined: 9 Mar, 2008
Posts: 458



Thanked 20 times

Dream Kudos: 350
My Contributions


the query is an INSERT, you should be using UPDATE
User is online!Profile CardPM

Go to the top of the page

msvp4u
post 22 Jul, 2008 - 03:31 PM
Post #3


New D.I.C Head

*
Joined: 15 Jul, 2008
Posts: 37


My Contributions


thanks a lot JBrace1990 it works
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/7/08 05:45PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month