Jump to content

Why this hidden variable will not pass value?


lamanonline1

Recommended Posts

I really dont know what wrong with this hidden variable input. They will not pass value and nothing show up in the database. Could somebody point out what wrong with it? Thanks alot for your helps.

<input type="hidden" name="fullname" value="' .$row['fullname']. '">
<input type="hidden" name="phone" value="' .$row['phone']. '">

Below is the full form

<?php
    mysql_connect("localhost", "root", "Mylovev1@") or die("Error connecting to database: ".mysql_error());
    /*
        localhost - it's location of the mysql server, usually localhost
        root - your username
        third is your password

        if connection fails it will stop loading the page and display an error
    */

    mysql_select_db("usnailsandspa") or die(mysql_error());
    /* tutorial_search is the name of database we've created */
?>

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body, html {
    height: 100%;
    margin: 0;
}

.bg {
    /* The image used */
    background-image: url("images/checkin_bg.jpg");

    /* Full height */
    height: 100%; 

    /* Center and scale the image nicely */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}
#textboxid1
{
    width: 340px;
    height:24px;
    font-size:14pt;
}
input[type=checkbox] {
  transform: scale(1.;
}
h2 {
  font: 300 75px/1.5 'Pacifico', Helvetica, sans-serif;
  color: #ad0101;
  text-shadow: 3px 3px 0px rgba(0,0,0,0.1), 7px 7px 0px rgba(0,0,0,0.05);
}
</style>
<link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>
</head>
<body>

<div class="bg">

<?php
    $query = $_GET['phone']; 
$connection = new mysqli('localhost', 'root', 'Mylovev1@', 'usnailsandspa');

    if ($connection->connect_errno > 0) {
        die ('Unable to connect to database [' . $connection->connect_error . ']');
    }   
    $sql = "SELECT * FROM customers where phone = ".$query."";
    if (!$result = $connection->query($sql)) {
        die ('There was an error running query[' . $connection->error . ']');
    }   
?>

<?php
    $rows = $result->num_rows;    // Find total rows returned by database
    if($rows > 0) {
        $cols = 1;    // Define number of columns
        $counter = 1;     // Counter used to identify if we need to start or end a row
        $nbsp = $cols - ($rows % $cols);    // Calculate the number of blank columns

                echo '<table width ="100%" height ="100%" align="center"><tr><td align="center" valign="middle"><h2>Gel Nails!</h2>
<font size="20" color="#ad0101"><b>Customer Records</b></font><hr></td></tr>';
        while ($row = $result->fetch_array()) {
            if(($counter % $cols) == 1) {    // Check if it's new row
                echo '<tr>';    
            }
     echo '<td align="center" valign="middle"><font size="6" color="#ad0101"><b>'.$row['fullname'].'&nbsp&nbsp&nbsp'.$row['phone'].'</b></font></td>';
            if(($counter % $cols) == 0) { // If it's last column in each row then counter remainder will be zero
                echo '</tr><tr>';   
            }
            $counter++;    // Increase the counter
}
        $result->free();
        if($nbsp > 0) { // Add unused column in last row
            for ($i = 0; $i < $nbsp; $i++)  { 
                echo '<td align="center"><form action="member_submit.php" method="post">
<input type="hidden" name="fullname" value="' .$row['fullname']. '">
<input type="hidden" name="phone" value="' .$row['phone']. '">
<label class="heading"><font size="6" color="#ad0101"><b>What do you need done today?</b></font></label><br>
<input type="checkbox" name="regular_pedi" value="Regular Pedi"><label><font size="5" color="#ad0101"><b>&nbspRegular Pedi&nbsp</b></font></label>
<input type="checkbox" name="shellac_pedi" value="Shellac Pedi"><label><font size="5" color="#ad0101"><b>&nbspShellac Pedi&nbsp</b></font></label>
<input type="checkbox" name="regular_meni" value="Regular Meni"><label><font size="5" color="#ad0101"><b>&nbspRegular Meni&nbsp</b></font></label>
<input type="checkbox" name="shellac_meni" value="Shellac Meni"><label><font size="5" color="#ad0101"><b>&nbspShellac Meni&nbsp</b></font></label><br>
<input type="checkbox" name="fullset" value="Fullset"><label><font size="5" color="#ad0101"><b>&nbspFullset&nbsp</b></font></label>
<input type="checkbox" name="fill" value="Fill"><label><font size="5" color="#ad0101"><b>&nbspFill&nbsp</b></font></label>
<input type="checkbox" name="dip" value="Dipping Powder"><label><font size="5" color="#ad0101"><b>&nbspDipping Powder&nbsp</b></font></label>
<input type="checkbox" name="wax" value="Waxing"><label><font size="5" color="#ad0101"><b>&nbspWaxing&nbsp</b></font></label>
<input type="checkbox" name="fix" value="Fix"><label><font size="5" color="#ad0101"><b>&nbspFix</b></font></label>
<br><br>
<input type="image" src="images/button_check-in.png" border="0" alt="Submit" value="submit"><br>
</form>
</td>';     
            }
            echo '</tr>';
        }
                echo '</table>';
    }
?>
</div>
</body>
</html>

And this is the code for member_submit.php

<?php
header('Location:checkin.php'); 
require 'connection.php';
$conn    = Connect();
$fullname    = $conn->real_escape_string($_POST['fullname']);
$phone    = $conn->real_escape_string($_POST['phone']);
$appointment_date = $conn->real_escape_string($_POST['appointment_date']);
$technictian    = $conn->real_escape_string($_POST['technictian']);
$regular_pedi    = $conn->real_escape_string($_POST['regular_pedi']);
$regular_meni = $conn->real_escape_string($_POST['regular_meni']);
$shellac_pedi    = $conn->real_escape_string($_POST['shellac_pedi']);
$shellac_meni = $conn->real_escape_string($_POST['shellac_meni']);
$fullset   = $conn->real_escape_string($_POST['fullset']);
$fill = $conn->real_escape_string($_POST['fill']);
$dip = $conn->real_escape_string($_POST['dip']);
$wax = $conn->real_escape_string($_POST['wax']);
$fix = $conn->real_escape_string($_POST['fix']);
$success = $conn->query($query);
$query2 = "INSERT INTO services (fullname, phone, appointment_date, technictian, regular_pedi, shellac_pedi, regular_meni, shellac_meni, fullset, fill, dip, wax, fix) VALUES('" . $fullname . "','" . $phone . "','" . $appointment_date . "','" . $technictian . "','" . $regular_pedi . "','" . $shellac_pedi . "','" . $regular_meni . "','" . $shellac_meni . "','" . $fullset . "','" . $fill . "','" . $dip . "','" . $wax . "','" . $fix . "')";
mysql_query($query2);
$success = $conn->query($query2);

if (!$success) {
    die("Couldn't enter data: ".$conn->error);

}

echo "Thank You For Contacting Us <br>";

$conn->close();

?>
Link to comment
Share on other sites

Look at what your form is doing.

 

For all the rows from your query you do a table row showing their name and phone number. Showing, not including in a form. After all that finishes and there are no more rows do you show the bits of the form with the hidden inputs and checkboxes.

 

It doesn't make sense.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.