SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2005
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Converting PHP form to submit unto MYSQL database

    Goodday,

    I have written a php form that can submit data into a file but could not get it working to submit unto MYSQL database.

    Can anyone help me on what to do to change the form now to be able to submit unto mysql database.

    For example:




    [] <?php
    $rand=rand("4567","7890");
    $random=md5($rand);
    $captcha= strtoupper(substr($random,0,4));
    $hidden= "<input name='captcha' type='hidden' id='userlevel' value='$captcha'>";
    echo <<<html
    <head>
    <title>USER REGISTRATION</title>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>User Registration</title>
    <style>
    TEXTAREA
    {
    FONT-SIZE: 10px;
    FONT-FAMILY: Verdana;
    }
    SELECT
    {
    FONT-SIZE: 10px;
    FONT-FAMILY: Verdana;
    }
    INPUT
    {
    FONT-SIZE: 10px;
    FONT-FAMILY: Verdana;
    }
    .error
    {
    FONT-FAMILY: verdana;
    font-size: 10px;
    color: #FF0000;
    }
    .blktext, .blktext:link, .blktext:visited
    {
    FONT-FAMILY: verdana;
    font-size: 10px;
    color: #000000;
    }
    .blktext:hover
    {
    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #ff9900;
    }
    .logininput
    {
    border: 1px solid #ff9900;
    WIDTH: 70px;
    FONT-SIZE: 10px;
    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
    }
    </style>
    </head>

    <body>
    <script>
    function CheckAgree()
    {
    var x = document.forms["regform"].agree.checked;
    if (x) return true;
    alert("You must agree to Terms and Conditions to continue registration");
    return false;
    }
    </script>

    <form action="adduser.php" method="POST" name="regform" onsubmit="return CheckAgree();">
    <div align="center">
    <center>
    <table>
    <tr><td align="center" height="11" width="448">&nbsp;
    <div align="left">
    <table border="0" width="438">
    <tbody><tr><td colspan="2" width="430">
    <p align="center"><b><font size="3">User Management </font></b>&nbsp;</td></tr>
    <tr>
    <td class="blktext" align="right" width="121"><b>Username</b></td>
    <td class="blktext" width="303">
    <input value="" name="username">
    <span class="error">*</span>
    </td>
    </tr>
    <tr>
    <td class="blktext" align="right" width="121"><b>Password</b></td>
    <td class="blktext" width="303">
    <input value="" name="password" type="password" size="20">
    <span class="error">*</span>
    </td>
    </tr>
    <tr>
    <td class="blktext" align="right" width="121"><b>Confirm Password</b></td>
    <td class="blktext" width="303">
    <input value="" name="retype" type="password" size="20">
    <span class="error">*</span>
    </td>
    </tr>
    <tr>
    <td class="blktext" align="right" width="121"><b>Email address</b></td>
    <td class="blktext" width="303">
    <input value="" name="email">
    <span class="error">* <b>(Valid email)</b></span>
    </td>
    </tr>[/]



    What do I need to do to be able to submit it into mysql database

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Send that data to another page, use that page to get the post variables and construct your sql insert query.
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •