0

i want to insert new data but the data didnt show up in database and didnt display for user
when i click foe change theres nothing happend
i couldnt find any error...ples help me

(BookingnDisplay.php)

<h1><?php
if($_SESSION["name"]) 
{
?>
Welcome <?php echo $_SESSION["name"]; ?>. Click here to <a href="logout.php" tite="Logout">Logout</a>.
<?php
}
?></h1>


<!--FORM-->
<div id="stylized" class="myform">

            <form method="POST" action="BookingnDisplay_Process.php"><!--link to DB-->
            <br>
            <h1><center>TALENT STUDIO Booking form</center></h1>
            <u><strong>Please read carefully.</strong></u></p>
            <p><strong>1. If in 15 minutes the user did come to claim the place, it will be
                  open to other walk-in user.</strong></p>


            <label>Name
            <span class="small">Add your name</span>
            </label>
            <input type="text" name="name" id="name" required />


            <label>Phone
            <span class="small">Add your phone number</span>
            </label>
            <input type="text" name="phone" id="phone" maxlength=
            "20" size="20" required />

            <label>Date
            <span class="small">Pick a date</span>
            </label>
            <input type="date" name="date" required />

            <label>Time From
            <span class="small">Insert time (ex : 08:00 AM)</span>
            </label>
            <input type="time" name="time_from" placeholder="hrs:mins" pattern="^([0-1]?[0-9]|2[0-4]):([0-0][0-0])(:[0-5][0-9])?$" class="inputs time" required/ />

            <label>Time Till
            <span class="small">Insert time (ex : 10:00 AM)</span>
            </label>
            <input type="time" name="time_till" placeholder="hrs:mins" 
            pattern="^([0-1]?[0-9]|2[0-4]):([0-0][0-0])(:[0-5][0-9])?$" class="inputs time" required/ />

            <label>Studio
            <span class="small">Choose studio</span>
            </label>
            <select name = "studio" required >
                    <option>Jamming</option>
                    <option>Dancing</option>
                    <option>Singing</option>
            </select>
            <br>     
            <br>
            <button type="submit">Submit</button> 
            <br>


            <br>
            <button type="reset">Clear</button>   


            <div class="spacer"></div>


            </form>

                </div>

        <!--FORM-->


        <div id="stylized" class="myform">
        <div id="display">

        <!--display user booked-->
        <?php

    require("dbase.php");

    include("dbase.php");



$query = "SELECT * FROM studio WHERE email1 = '".$_SESSION["email"]."';";
$result = mysql_query($query, $conn);

$row = mysql_fetch_array($result);

    $name = $row["name"];
    $phone = $row["phone"];
    $date = $row["date"];
    $time_from = $row["time_from"];
    $time_till = $row["time_till"];
    $studio = $row["studio"];

?>
<br><br><li> 

Name: <?php echo $name; ?><br>
Phone No.: <?php echo $phone; ?><br>
<strong>Date: <?php echo $date; ?><br></strong>
<strong>Time from: <?php echo $time_from; ?><br></strong>
<strong>Time till: <?php echo $time_till; ?><br> </strong>
<strong>Studio: <?php echo $studio; ?><br></strong>
Action : <strong><a href="changeBookUser.php?id=<?php echo id; ?>">Change</a>
</strong>/<strong><a href="deleteBookingUser.php?id=<?php echo $id; ?>">Delete</a></strong>

<?php

?>  

(BookingnDisplay_Process.php)
<!-- To insert data of BookingnDisplay.php into database. -->

    <?php

    require("dbase.php");

    //get details
    include("dbase.php");


    extract( $_POST );

$name = mysql_real_escape_string ($_POST['name']);
$phone =  mysql_real_escape_string ($_POST['phone']);
$date = mysql_real_escape_string ($_POST['date']);
$time_from = mysql_real_escape_string ($_POST['time_from']);
$time_till = mysql_real_escape_string ($_POST['time_till']);
$studio = mysql_real_escape_string($_POST['studio']);


$query = "UPDATE studio SET  
name='$name',
phone='$phone',
date='$date',
time_from='$time_from',
time_till='$time_till',
studio='$studio'

WHERE email1 = '".$_SESSION["email"]."';";

$result = mysql_query($query,$conn) or die("Could not execute query in isistdkanBooking.php");

if($result) {
    header("Location: BookingnDisplay.php");

    }

?>
2
Contributors
1
Reply
20
Views
3 Years
Discussion Span
Last Post by ehpratah
1

Hi if your gonna insert new data in the db why are you using UPDATE query?

you need to use INSERT query like

$query= "INSERT INTO studio(name,phone,`date`,time_from,time_till,studio) VALUES ('$name','$phone','$date','$time_from','$time_till','$studio')";

also mysql_real_escape_string is already deprecated refer to this link and you better use mysqli or pdo for the same reason

Edited by ehpratah: TYPO

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.