Jump to content

VictorObah

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by VictorObah

  1. thanks for your response.. but i am still finding it hard to compute all together.

     

    i do have a login system which is loggin in successfully.

     

    after a successful login.. the user submit a form value to another table called  " info"  in database which is submitting successfully.

     

    all i want is that,  the new form value submitted to table "info" in database should print on the next page " account-tr.php"

     

    here is my html table

     

     

    <form action="sub.php" method="post" enctype="multipart/form-data" name="form1">
      <p>price
        <label for="price"></label>
        <input type="text" name="price" id="price">
      </p>
      <p>size
        <input type="text" name="size" id="size">
      </p>
      <p>location
        <input type="text" name="location" id="location">
      </p>
      <p>type
        <input name="type" type="text" id="type">
        <input type="submit" name="button" id="button" value="Submit">
        <label for="user_id"></label>
        <input name="user_id" type="hidden" id="user_id" value="<?php echo "" . $_SESSION['id'] . ""; ?>">
      </p>
    </form>

     

    this is my insert.php code

     

    <?php 
    include ("config.php");
    $user_id=mysql_real_escape_string($_SESSION['user_id']);
    $price=mysql_real_escape_string($_SESSION['price']);
    $size=mysql_real_escape_string($_SESSION['pair']);
    $location=mysql_real_escape_string($_SESSION['bid']);
    $type=mysql_real_escape_string($_SESSION['amt']);
     
     
    $sql="INSERT INTO $tbl_names(user_id,price,size,location,type)
    VALUES('$_POST[user_id]','$_POST[price]','$_POST','$_POST[location]','$_POST[type]')";
    $result=mysql_query($sql);
    header ("location:account-tr.php");
    ?>
     
     
    the is my select statement
     
    $sql=mysql_query("SELECT * FROM $tbl_names WHERE user_id='" . $_SESSION[ "user_id" ] . "' ORDER BY user_id ASC LIMIT 0, 1");
    $result=mysql_query($sql);
    $row=mysql_fetch_assoc($result); ?>

     

     

    config.php

     

    <?php
    $host
    ="localhost"; // Host name 
    $username="*****"; // Mysql username 
    $password="*****"; // Mysql password 
    $db_name="****"; // Database name  
    $tbl_name="info"; // Table name


    // Connect to server and select database.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db
    ("$db_name")or die("cannot select DB"); 
    ?>
  2. i created a insert php code which successfully submit to database but i was lost at some point because what i really wanted was a php code that will print on the next page after submission to db

     

     

     



    <?php


    include ("config.php");


    //Connect to server and select databse.
    mysql_connect   ("$host", "$username", "$password")   or     die("cannot connect to server");
    mysql_select_db("$db_name") or  die("cannot select DB");


    $    p= $_POST['firstname'];
    $    b= $_POST['lastname'];    
    $    a= $_POST['location']; 
    $    user= $_POST['username'];
    $    d= $_POST['dt']; 
    $    am=$_POST['state']; 
    $    p=$_POST['password']; 
    $    f=$_POST['sex']; 


    $sql="INSERT INTO $tbl_name(firstname,lastname,location,username,dt,state,password,sex)
    VALUES('$_POST[firstname]','$_POST[lastname]','$_POST[location]','$_POST[username]','$_POST[dt]','$_POST[state]','$_POST[password]','$_POST[sex]')";
    $result=mysql_query($sql);


    header ("location:account-tr.php");


    ?>


     

     

    config.php

     



    <?php
    $host="localhost"; // Host name 
    $username="*****"; // Mysql username 
    $password="*****"; // Mysql password 
    $db_name="****"; // Database name  
    $tbl_name="registration"; // Table name


    // Connect to server and select database.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB"); 
    ?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.