line app

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adams77
Forum Newbie
Posts: 3
Joined: Sun Feb 23, 2014 8:18 am

line app

Post 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
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: line app

Post by Christopher »

If you want it disabled then just show the value but not the radio buttons when you generate the page.
(#10850)
adams77
Forum Newbie
Posts: 3
Joined: Sun Feb 23, 2014 8:18 am

Re: line app

Post by adams77 »

but i want to let others pick different times
adams77
Forum Newbie
Posts: 3
Joined: Sun Feb 23, 2014 8:18 am

Re: line app

Post 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;
 
}  
 
?>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: line app

Post by Celauran »

You've got HTML mixed in with your PHP, specifically your form tags.
Post Reply