Jump to content

PHP array checkbox help xD storing in database


rmariano02

Recommended Posts

when i try to run this code no error comes out but the values is not storing in the database please help T_T

 

Interface(client.php)

<form action="reserve.php" method="post">

Date: <select name='month'>

 

<?php

$montharray = array ("01","02","03","04",

"05","06","07","08","09"

,"10","11","12");

foreach($montharray as $month){

echo "<option value=$month>$month</option>";

}

?>

</select>

 

<select name='day'>

<?php

for($i=1; $i<=31; $i++){

echo "<option value=$i>$i</option>";

}

?>

</select>

 

<select name='year'>

<?php

for($i=date(Y); $i>=1935; $i--){

echo "<option value=$i>$i</option>";

}

?>

</select>

<br/>

Time: <select name="time">

<option value="10:00"> 10:00 am</option>

<option value="11:00"> 11:00 am</option>s

<option value="12:00"> 12:00 pm</option>

<option value="1:00"> 1:00 pm</option>

<option value="2:00"> 2:00 pm</option>

<option value="3:00"> 3:00 pm</option>

<option value="4:00"> 4:00 pm</option>

<option value="5:00"> 5:00 pm</option>

<option value="6:00"> 6:00 pm</option>

<option value="7:00"> 7:00 pm</option>

<option value="8:00"> 8:00 pm</option>

 

</select>

<br/>

Service:<br/>

<input name="0" value="check" type="checkbox"> Facial</input><br/>

<input name="1" value="check" type="checkbox"> Diamond Microderma</input><br/>

<input name="2" value="check" type="checkbox"> Peeling Procedure</input><br/>

<input name="3" value="check" type="checkbox"> Pimple Treatment</input><br/>

<input name="4" value="check" type="checkbox"> Pimple Injection</input><br/>

<input name="5" value="check" type="checkbox"> Acne Surgery</input><br/>

<input name="6" value="check" type="checkbox"> Cautery</input><br/>

<input name="7" value="check" type="checkbox"> Acne-prone skin microneeding</input><br/>

<input name="8" value="check" type="checkbox"> Advanced stem cell microneeding therapy</input><br/>

<input name="9" value="check" type="checkbox"> Needle-less stem cell infusion</input><br/>

<input name="10" value="check" type="checkbox"> Needle-less mesolift</input><br/>

<input name="11" value="check" type="checkbox"> Botox</input><br/>

<input name="12" value="check" type="checkbox"> Bio hair growth stem cell infusion</input><br/>

<input name="13" value="check" type="checkbox"> RF Figure countour</input><br/>

<input name="14" value="check" type="checkbox"> Slimming Massage</input><br/>

<input name="15" value="check" type="checkbox"> PT Metabolic Accelerator</input><br/>

<input name="16" value="check" type="checkbox"> Mesotherapy</input><br/>

<input name="17" value="check" type="checkbox"> Ultrasonic Liposuction</input><br/>

<input name="18" value="check" type="checkbox"> Filler</input><br/>

<input name="19" value="check" type="checkbox"> Hair Removal</input><br/>

<input name="20" value="check" type="checkbox"> Photorejuvenation</input><br/>

<input name="21" value="check" type="checkbox"> Hyperpigmentation</input><br/>

<input name="22" value="check" type="checkbox"> Acnecontrol</input><br/><br/>

<input name="reserve" type="submit" onclick="show_alert()" value="Make Resevation">

</form>

 

Validation(reserve.php)

<?php

 

include('chkconnection.php');

session_start();

$user = $_SESSION['loggedInUser'];

 

for($x=0;$x<=23;$x++){

$chk[$x] = 'uncheck';

}

 

if(isset($_POST["reserve"])){

for($x=0;$x<=23;$x++){

if(isset($_POST["$x"])){

$chk[$x] = $_POST["$x"];

}

}

 

$date = $_POST["year"].$_POST["month"].$_POST["day"];

$time = $_POST["time"];

 

mysql_query("INSERT INTO ff_tblreserve (Facial,

Diamond_Microderma,

PeelingsProcedure,

Pimple_Treatment,

Pimple_Injection,

Acne_Surgery,

Acne_prone_skin_microneeding,

Advanced_stem_cell_microneeding_therapy,

Needle_less_stem_cell_infusion,

Needle_less_mesolift,

Botox,

Bio_hair_growth_stem_cell_infusion,

RF_Figure_countour,

Slimming_Massage,

PT_Metabolic_Accelerator,

Mesotherapy,

Ultrasonic_Liposuction,

Filler,

Hair_Removal,

Photorejuvenation,

Hyperpigmentation,

Acnecontrol,

time,

date,

id)

VALUES

('$chk[1]','$chk[2]','$chk[3]','$chk[4]','$chk[5]','$chk[6]','$chk[7]','$chk[8]','$chk[9]','$chk[10]','$chk[11]',

'$chk[12]','$chk[13]','$'chk[14]','$chk[15]','$chk[16]','$chk[17]','$chk[18]','$chk[19]','$chk[20]','$chk[21]',

'$chk[22]','$chk[23]','$time','$date',$user)");}

 

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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