Jump to content

Adam77

Members
  • Posts

    9
  • Joined

  • Last visited

Adam77's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. hey guys i simplify my code but i still have a little syntax problem i cant solve, please help <?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; } ?>
  2. it doesnt really help read all different function and i do have some clue in php .. i know i need to regenerate my radio buttons each time someone is picking a radio button but i dont know how this is all my php file <?php ini_set('display_errors', 'Off'); if(isset($_POST['submitted'])){ include("connect.php"); $choice = $_POST['placeInLine']; 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; $disabled = ($choice != '') ? 'disabled' : ''; } //end of the main if statment ?> <!DOCTYPE html> <html > <head> <title> shop </title> <meta http-equiv="content-type" content="text/html; charset-utf-8" /> </head> <body> <form id= "line" name="line " action="index.php" method="post"> <input type="hidden" name="submitted" value="true"/> <ul> <li><input type="radio" name="placeInLine" id="choice1" value="1"'.$ch[1].' onclick="toggle('show')" />10:00-11:15</li> <div><form action="" method="POST"></form><input type="radio" name="gender" id="man">man <form action="" method="POST"></form><input type="radio" name="gender" id="woman">woman <form action="" method="POST"></form>remarks<input type="<textarea name="Name" rows="8" cols="40"></textarea></div> <li><input type="radio" name="placeInLine" id="choice2" value="2"'.$ch[2].'onclick="toggle('show')" />10:15-10:30</li> <div><form action="" method="POST"></form><input type="radio" name="gender" id="man">man <form action="" method="POST"></form><input type="radio" name="gender" id="woman">woman <form action="" method="POST"></form>remarks<input type="<textarea name="Name" rows="8" cols="40"></textarea></div> <li><input type="radio" name="placeInLine" id="choice3" value="3"'.$ch[3].' onclick="toggle('show')"/>10:30-11:45</li> <div><form action="" method="POST"></form><input type="radio" name="gender" id="man">man <form action="" method="POST"></form><input type="radio" name="gender" id="woman">woman <form action="" method="POST"></form>remarks<input type="<textarea name="Name" rows="8" cols="40"></textarea></div> <li><input type="radio" name="placeInLine" id="choice4" value="4"'.$ch[4].' onclick="toggle('show')"/>10:45-11:15</li> <div><form action="" method="POST"></form><input type="radio" name="gender" id="man">man <form action="" method="POST"></form><input type="radio" name="gender" id="woman">woman <form action="" method="POST"></form>remarks<input type="<textarea name="Name" rows="8" cols="40"></textarea></div> <li><input type="radio" name="placeInLine" id="choice5" value="5" onclick="toggle('show')"/>11:15-11:30</li> <div><form action="" method="POST"></form><input type="radio" name="gender" id="man">man <form action="" method="POST"></form><input type="radio" name="gender" id="woman">woman <form action="" method="POST"></form>remarks<input type="<textarea name="Name" rows="8" cols="40"></textarea></div> <li><input type="radio" name="placeInLine" id="choice6" value="6" onclick="toggle('show')"/>11:30-11:45</li> <div><form action="" method="POST"></form><input type="radio" name="gender" id="man">man <form action="" method="POST"></form><input type="radio" name="gender" id="woman">woman <form action="" method="POST"></form>remarks<input type="<textarea name="Name" rows="8" cols="40"></textarea></div> <li><input type="radio" name="placeInLine" id="choice7" value="7" onclick="toggle('show')"/>11:45-12:00</li> <div><form action="" method="POST"></form><input type="radio" name="gender" id="man">man <form action="" method="POST"></form><input type="radio" name="gender" id="woman">woman <form action="" method="POST"></form>remarks<input type="<textarea name="Name" rows="8" cols="40"></textarea></div> <li><input type="radio" name="placeInLine" id="choice8" value="8" onclick="toggle('show')"/>12:00-12:15</li> <div><form action="" method="POST"></form><input type="radio" name="gender" id="man">man <form action="" method="POST"></form><input type="radio" name="gender" id="woman">woman <form action="" method="POST"></form>remarks<input type="<textarea name="Name" rows="8" cols="40"></textarea></div> <br /> <input type="submit" value="Save my choice" class="button" /> </ul> </form> <script type="text/javascript" src="jquery-1.11.0.js"></script> <script type="text/javascript" src="javaScript.js"></script> </body> </html>
  3. never . if its complicate can you just give me some key terms of what i need nd ill try to find it ?
  4. hey man, thanks for the help but i still dont understand how to write the loop on it ? right now it chooses the first button to be disabled
  5. you disable the third choice in your code but how do i let the user do it ?
  6. hey guys please help me out here ! i did a time line which people fill 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
  7. hey guys please help me out here ! i did a time line which people fill 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
  8. Adam77

    schedule form

    A schedule timeline
  9. Adam77

    schedule form

    hey guys , im trying to build a schedule form in which users can pick their time in the line(by radio button) . a) how do i transfer the radio button variable to the sql chart by php ? b)how do i make the radio button that already was being picked up to be disable(so no one could pick the same time in line again ) ? thanks, i hope i was clear enough my html <form id= "line" name="line " action="form_script.php" method="post"> <ul> <li><input type="radio" name="placeInLine" id="choice1" value="1" />10:00-11:15</li> <li><input type="radio" name="placeInLine" id="choice2" value="2" />10:15-10:30</li> <ul>
×
×
  • Create New...