Page 1 of 1

line app

Posted: Sun Feb 23, 2014 8:27 am
by adams77
hey guys please help me out here !

i did a time line which people take their place in line with radio button , now i want to make the radio that
already been picked to be disable for everyone else so it cant be picked twice . i have an sql database where i put(by php) the submitted picking.

will appreciate any help !!!
Adam

Re: line app

Posted: Sun Feb 23, 2014 10:15 pm
by Christopher
If you want it disabled then just show the value but not the radio buttons when you generate the page.

Re: line app

Posted: Mon Feb 24, 2014 12:11 am
by adams77
but i want to let others pick different times

Re: line app

Posted: Tue Feb 25, 2014 4:52 pm
by adams77
hey man ,

do you mind take a look at my code? i have a syntax problem i cant solve

Code: Select all

<?php
 
include("connect.php");
 
ini_set('display_errors', 'Off');
 
 
if(isset($_POST['submitted'])){
 
$choice = $_POST['placeInLine'];
  
$query = "SELECT `choice` FROM `placeinline`";
$result = mysql_query($query );
 
 
if($query_run = mysql_query($query) ){
 
echo 'good';
}else{
 
echo mysql_error();
}
 
 
$disab = '' ;
 
$row = mysql_fetch_row($result);
 
if($choice==$row){
 
$disab = 'disabled';
 
}
 
      
   <form id= "line" name="line " action="test1.php" method="post">
    echo "<li> <input type='radio' name='placeInLine' id='choice1'  $disab value='1' /> 10:00-10:15 </li>";
    echo "<li> <input type='radio' name='placeInLine' id='choice2'  $disab value='2' /> 10:15-10:30 </li>";
    echo "<li> <input type='radio' name='placeInLine' id='choice3'  $disab value='3' /> 10:30-10:45 </li>";
    echo "<li> <input type='radio' name='placeInLine' id='choice4'  $disab value='4' /> 10:45-11:00 </li>";
    echo "<li> <input type='radio' name='placeInLine' id='choice5'  $disab value='5' /> 11:00-11:15 </li>";
    echo "<li> <input type='radio' name='placeInLine' id='choice6'  $disab value='6' /> 11:15-11:30 </li>";
   </form>
 
mysql_query("INSERT INTO $table(choice) VALUES ($choice)") or die(mysql_error());
 
$sqlinsert = "INSERT INTO placeinline (choice) VALUES ($choice)";
 
$newrecord = "1 choice added to the line";
echo $newrecord;
 
}  
 
?>

Re: line app

Posted: Tue Feb 25, 2014 5:19 pm
by Celauran
You've got HTML mixed in with your PHP, specifically your form tags.