Hi , How can I show CaseID once user has fill up the form .

My database : CaseID , Name , Feedback

The form will require user to enter name and feedback . After submit button is enter , the CaseID should be show to user .

How can I do it ? I am using xampp as database.

Member Avatar for LastMitch

How can I do it ? I am using xampp as database.

@erminasrcutp

How do you want it? PHP or jQuery or javascript?

anything as long as it works ..
PHP will be given priority

Member Avatar for LastMitch

PHP will be given priority

@erminasrcutp

Do you know or familiar with PHP at ?

yes :) well i manage to insert data to database myqsl however i dont manage to show user the caseID which is auto increment

Member Avatar for LastMitch

yes :) well i manage to insert data to database myqsl however i dont manage to show user the caseID which is auto increment

Post your INSERT query, then we can go from there

<!DOCTYPE>
<html>

<head>
    <title>feedback</title>
  </head>

    <div id="header">  
         <img src='banner.png' align='middle'>
    </div>

    <div id="navigation">            
        <div class="mainMenu">
            <ul><li>
                <a  echo ;   href='main.php' >Main</a>
            </li><li>

                <a  echo class='selected';  href='feedback.php'>
                    New feedback</a>
        </div>
    </div>

    <div id="content"> 

    <form name="borang"  method="post" 
    onsubmit="return checkField()"  enctype="multipart/form-data">

    <table align="center" id="table" >
        <th colspan="2" class="th">feedback form</th>
        <tr>
            <td class="td" colspan="2">
            <br/>
                have to be fill
            <span class="span">*</span> 
            </td>
        </tr>


    <tr>
        <td class="td">
        <br/>
            name
        </td>
        <td>
        <br/> 
        <input type="text" name="name" value="" />
        </td>
    </tr>

    <tr>
        <td class="td">
            feedback 
        </td>
        <td> 
        <input type="text" name="feedback" value="" />
        <span class="span">*</span> 
        </td>
    </tr>


        <tr>
            <td class="td">                   
            </td>
            <td class="td" >
                <br/>
                <button type="submit" value="submit"name="submit"/>
                    check
                </button> 
                <button type="reset" value="reset"/>
                    reset
                </button> 
                <br/>
            </td>
        </tr>
    </table>
    <br><br>

    <?php 
    if (isset($_POST ['submit'])){

    $con = mysql_connect("localhost","root","");
    if (!$con)
    {
        die("Can not connect ".mysql_error());
    }

    mysql_select_db("database",$con);
    $sql = "INSERT INTO aduan(name,feedback)
    VALUES('$_POST[name]','$_POST[feedback]')";
    mysql_query($sql,$con);
    mysql_close($con);
    } 

    ?>

 </form>

  </div>

    <div id="footer">
        Bye bye
    </div>

</body>
</html>

you probably need to use this function: http://pk1.php.net/mysql_insert_id

have you looked at it before?

Let me know if you need further help about where to call this function and to display the id of newly inserted row that it will return to the user in subsequent response.

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.