PHP - Retaining Radio Button Check Values Upon Reload/fail Of Validation Etc.
Hi guys,
I am having a real problem with this and I can't figure it out. I am not that much of a techie so take it easy on me. I am building a survey form for a website to get feedback on the service, and naturally it can fail validation if the email address is misspelled or the security question is answered wrong. Retaining text values was easy and I managed to dig around for some solutions to retain radio button values. The problem is IT ONLY WORKS ON ONE OPTION! I tried everything including coming up with completely separate value names, yet the page still loads with all radio options set to the same shared value (usually of the last radio button question). Here is my code: <?PHP $Excellent_status = 'unchecked'; $VeryGood_status = 'unchecked'; $Satisfactory_status = 'unchecked'; $Weak_status = 'unchecked'; $Horrible_status = 'unchecked'; if (isset($_POST['send'])) { $selected_tk = $_POST['tk']; if ($selected_tk == 'Excellent') { $Excellent_status = 'checked'; } else if ($selected_tk == 'VeryGood') { $VeryGood_status = 'checked'; } else if ($selected_tk == 'Satisfactory') { $Satisfactory_status = 'checked'; } else if ($selected_tk == 'Weak') { $Weak_status = 'checked'; } else if ($selected_tk == 'Horrible') { $Horrible_status = 'checked'; } } $Excellent2_status = 'unchecked'; $VeryGood2_status = 'unchecked'; $Satisfactory2_status = 'unchecked'; $Weak2_status = 'unchecked'; $Horrible2_status = 'unchecked'; if (isset($_POST['send'])) { $selected_ts = $_POST['ts']; if ($selected_ts == 'Excellent') { $Excellent2_status = 'checked'; } else if ($selected_ts == 'VeryGood') { $VeryGood2_status = 'checked'; } else if ($selected_ts == 'Satisfactory') { $Satisfactory2_status = 'checked'; } else if ($selected_ts == 'Weak') { $Weak2_status = 'checked'; } else if ($selected_ts == 'Horrible') { $Horrible2_status = 'checked'; } } ?> <h1 align="center">Feedback Form:</h1> <p align="center">We highly value your input. Your feedback can help us serve you better and provide you with a holistic experience that meets or exceeds all your expectations. <br /> Please take the time to fill out the form below.</p> <br /> <br /> <p align="center"><strong>(Fields marked with a <span class="required">*</span> are necessary. The course information is to validate which course and batch the survey is regarding, and the name and email allows our admin to verify the details and gain more information from you if needed)</strong></p> <p align="center"><strong>The identity in this form is strictly confidential, and it will not be revealed to course trainer, co-ordinator, or your sponsor.</strong></p> <!--Error Message--> <?php echo $error;?> <form method="post" name="contFrm" id="contFrm" action=""> <label><span class="required">*</span>Name:</label> <input name="name" type="text" class="box" id="name" size="40" value="<?php echo $name;?>" /><br /> <label><span class="required">*</span>Email: </label> <input name="email" type="text" class="box" id="email" size="40" value="<?php echo $email;?>" /><br /> <label><span class="required">*</span>Course attended: </label> <input name="course" type="text" class="box" id="course" size="40" value="<?php echo $course;?>" /><br /> <label><span class="required">*</span>Course Date and City: </label> <input name="dateplace" type="text" class="box" id="dateplace" size="40" value="<?php echo $dateplace;?>" /><br /><br /><br /> <table width="980" border="1" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td width="280" align="left" bgcolor="#285A80"><strong><font color="#FFFFFF" size="+1">Attribute</font></strong></td> <td width="115"> <div align="center">EXCELLENT! </div></td> <td width="115"> <div align="center">Really Good. </div></td> <td width="115"> <div align="center">Satisfactory. </div></td> <td width="115"> <div align="center">Weak, needs attention. </div></td> <td width="115"> <div align="center">Horrible! Unacceptable. </div></td> </tr> <tr> <td width="280" align="left" bgcolor="#71C4CD"><strong><font color="#333333">Trainer Knowledge</font></strong></td> <td> <div align="center"> <input type="radio" name="tk" id="Excellent" value="Excellent" <?PHP print $Excellent_status; ?>/> </div> </td> <td> <div align="center"> <input type="radio" name="tk" id="VeryGood" value="VeryGood" <?PHP print $VeryGood_status; ?>/> </div> </label></td> <td> <div align="center"> <input type="radio" name="tk" id="Satisfactory" value="Satisfactory" <?PHP print $Satisfactory_status; ?>/> </div> </td> <td> <div align="center"> <input type="radio" name="tk" id="Weak" value="Weak" <?PHP print $Weak_status; ?>/> </div> </td> <td> <div align="center"> <input type="radio" name="tk" id="Horrible" value="Horrible" <?PHP print $Horrible_status; ?>/> </div> </td> </tr> <tr> <td width="280" align="left" bgcolor="#71C4CD"><strong><font color="#333333">Trainer Style and Presentation</font></strong></td> <td> <div align="center"> <input type="radio" name="ts" id="Excellent2" value="Excellent2" <?PHP print $Excellent2_status; ?>/> </div> </td> <td> <div align="center"> <input type="radio" name="ts" id="VeryGood2" value="VeryGood2" <?PHP print $VeryGood2_status; ?>/> </div> </label></td> <td> <div align="center"> <input type="radio" name="ts" id="Satisfactory2" value="Satisfactory2" <?PHP print $Satisfactory2_status; ?>/> </div> </td> <td> <div align="center"> <input type="radio" name="ts" id="Weak2" value="Weak2" <?PHP print $Weak2_status; ?>/> </div> </td> <td> <div align="center"> <input type="radio" name="ts" id="Horrible2" value="Horrible2" <?PHP print $Horrible2_status; ?>/> </div> </td> </tr> </table> <br /><br /> <label>Particularly positive points you appreciated: </label> <textarea name="message1" cols="80" rows="3" id="message1"><?php echo $message1;?> </textarea><br /> <label>Particularly negative points you found disappointing: </label> <textarea name="message2" cols="80" rows="3" id="message2"><?php echo $message2;?> </textarea><br /> <label>Any specific message you would like to provide us: </label> <textarea name="message3" cols="80" rows="3" id="message3"><?php echo $message3;?> </textarea><br /> <label><span class="required">* Security Question</span></label><? require_once ("ClassMathGuard.php"); MathGuard::insertQuestion(); ?> <br /> <br /> <!-- Submit Button--> <input name="send" type="submit" class="button" id="send" value="" /> </form> Fact is there are 8 questions (all multiple choice with radio button answers) but I decided to save you a long code read. Basically what I get is that despite choosing different answers for each question, the retention is only of the last option or question, and all the above question choices are set to that choice button. What is wrong? Similar TutorialsI am having some difficulty with accessing radio button values with PHP code. Please see the attached file
Attached Files
x.txt 530bytes
11 downloads i have an rsvp page where the table is populated by guests according to event selected in the drop down list. the rsvp table has 2 columns: guest names and status. status(radio button) is divided into 3: unconfirmed(default status), attending and not attending. user has to choose either one. but i am having trouble saving the status. tia for any help!
this is the saving code:
<?php if(isset($_SESSION['sess_user_id'])) { if(isset($_POST['save-rsvp'])) { require "connection.php"; $name = $_POST['name']; $radio = $_POST['rsvp']; $session = $_SESSION['sess_user_id']; $rsvp = $dbh->prepare("UPDATE guest SET status = ? WHERE guser_id = ? AND guest_name = ?"); $rad = implode("','", $radio); for($i = 0; $i < count($_POST['name']); $i++) { if(trim($_POST['name'][$i]) !== '')// validate this form { $rsvp->bindParam(1, $rad, PDO::PARAM_INT); $rsvp->bindParam(2, $session, PDO::PARAM_INT); $rsvp->bindParam(3, $name[$i], PDO::PARAM_STR); $rsvp->execute(); } } } } ?>which when save doesn't save according to status selected. for example 5 names: noreen, pete, marzuki, nora, mishal noreen unconfirmed pete attending marzuki attending nora attending mishal not attending micah not attending when saved, all is saved as unconfirmed. noreen not attending pete attending marzuki not attending nora attending mishal not attending micah attending when saved, all is saved as not attending. noreen attending pete not attending marzuki attending nora not attending mishal attending micah not attending when saved, all is saved as attending. it seems to save according to first choice. Hello! I am designing a user registration form which has some radio buttons for people to select. I am confused as to how I should store the value selected by the user into the database. Here is my code, just in case. <li id="li_2" > <label class="description" for="element_2">I am a </label> <span> <input id="element_2_1" name="element_2" class="element radio" type="radio" value="1" /> <label class="choice" for="element_2_1">Student</label> <input id="element_2_2" name="element_2" class="element radio" type="radio" value="2" /> <label class="choice" for="element_2_2">Staff</label> <input id="element_2_3" name="element_2" class="element radio" type="radio" value="3" /> <label class="choice" for="element_2_3">Member</label> <input id="element_2_4" name="element_2" class="element radio" type="radio" value="4" /> <label class="choice" for="element_2_4">Other</label> </span> </li> This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=350049.0 Hi community. The radio buttons on my form suddenly stopped working. For the life of me I can’t figure out why. Everything seems to look fine. I did some moving around on servers so I wonder if something got messed up during the transfer. I’m wondering if a new version of PHP was installed and made something obsolete. I was wondering if someone could take a look. Thank you in advance for your advise.
<form action="brian_1.php" method="post" name="form1" id="form1"> <input name="name" type="text" id="name" size="30" tabindex="1"/> Company if Applicable: <input name="company" type="text" id="company" size="30" tabindex="2"/> Phone: <input name="phone" type="text" id="phone" tabindex="3" onkeypress="return formatPhone(event,this)" onkeydown="return getKey(event,this)" size="13" maxlength="12"/> Example: XXXXXXXXXX Alternate Phone: <input name="altphone" type="text" id="altphone" tabindex="4" onkeypress="return formatPhone(event,this)" onkeydown="return getKey(event,this)" size="13" maxlength="13"/> Example: XXXXXXXXXX Street Address:<input name="mail" type="text" id="mail" size="60" tabindex="5"/> City, State, Zip Code: <input name="city" type="text" id="city" size="60" tabindex="5"/> E-mail: <input name="emai" type="text" id="emai" size="60" tabindex="6"/> Would you like to be part of our mailing list? <label><input type="radio" name="list" value="Yes" id="RadioGroup1_0" tabindex="7"/>Yes</label><label><input type="radio" name="list" value="No" id="RadioGroup1_1" tabindex="8"/>No</label> Are you interested in volunteering for upcoming events? <label><input type="radio" name="volunteer" value="Yes" id="RadioGroup2_0" tabindex="9"/>Yes</label><label><input type="radio" name="volunteer" value="No" id="RadioGroup2_1" tabindex="10"/>No</label> Are you interested in becoming a sponsor by receiving opportunities to advertise through us? <label><input type="radio" name="opportunities" value="Yes" id="RadioGroup3_0" tabindex="11"/>Yes</label><label><input type="radio" name="opportunities" value="No" id="RadioGroup3_1" tabindex="12"/>No</label> Would you like to join our efforts by offering your services or products to further our cause? <label><input type="radio" name="cause" value="Yes" id="RadioGroup4_0" tabindex="15"/>Yes</label><label><input type="radio" name="cause" value="No" id="RadioGroup4_1" tabindex="16"/>No</label> If so, in what ways would you like to contribute? <textarea name="contribute" cols="60" rows="4"></textarea> <input type="submit" name="Submit" value="Sumbit" /><input type="reset" name="reset" id="reset" value="Clear" /> </form> <?php /* Email Variables */ $emailSubject = 'Contact Form'; $webMaster = 'brianewagnerfund@gmail.com'; $webMaster = 'matt@webskillsplus.com'; //$webMaster = 'murrterr@rcn.com'; /* Data Variables */ $name = $_POST['name']; $company = $_POST['company']; $phone = $_POST['phone']; $altphone = $_POST['altphone']; $mail = $_POST['mail']; $city = $_POST['city']; $emai = $_POST['emai']; if (isset($_POST["submit"])) { echo $_POST["list"]; } if (isset($_POST["submit"])) { echo $_POST["volunteer"]; } if (isset($_POST["submit"])) { echo $_POST["opportunities"]; } if (isset($_POST["submit"])) { echo $_POST["cause"]; } $contribute = $_POST['contribute']; $body = <<<EOD \r\n \r\n <br> Name(s): $name \r\n <br> Company if Applicable: $company \r\n <br> Phone: $phone \r\n <br> Alternate Phone: $altphone \r\n <br> Street Address: $mail \r\n <br> City, State, Zip Code: $city \r\n <br> Email: $emai \r\n <br> Would you like to be part of our mailing list? $list \r\n <br> Are you interested in volunteering for upcoming events? $volunteer \r\n <br> Are you interested in becoming a sponsor by receiving opportunities to advertise through us? $opportunities \r\n <br> Would you like to join our efforts by offering your services or products to further our cause? $cause \r\n <br> If so, in what ways would you like to contribute? $contribute \r\n <br> EOD; $from = "From: BrianEWagnerFund@gmail.com\r\n"; $from .= "Reply-To: ".$emai."\r\n"; $from .= "Content-type: text/html\r\n"; mail($webMaster, $emailSubject, $body, $from); /* Results rendered as HTML */ echo "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.brianewagnerfund.org/thankyou.html\">"; ?> I have a form and on each input I set the value as the post variable of it's self. I do this so that if the user submit the form and it has errors they haven't lost the data they have inputted. For example <input name="input1" type="text" value="<?php echo($_POST['input1']); ?>" /> This works fine for text field and textarea's but how do I retain the value of radio boxes and checkboxes? Hi guys, I had a problem before which is similar to the problem im about to describe, however Pikachu helped me solve the last problem so a big thanks to him! However this problem is slightly different and im struggling to find a solution. I will first describe the problem I had which pikachu helped me solve as it would be easier for me to describe this past problem. I have an update form, so a user can edit existing records which are pulled from a database. When the user changes the values in a text field then submits the form, the values in the text fields updates fine. However if they change the values in the text box and then tries to submit the form but there was an error, the values in the text fields go back to the values from the database and the user has to change the text fields again. Well this problem was solved with the help of pikachu and the this is what I did... <?php if(isset($_POST['title'])){echo htmlspecialchars($_POST['title']);} else if (isset($title)) {echo htmlspecialchars($title);}?> Again, the above works fine however the problem I have now is the same problem as described above however it relates to drop down menus and not text fields. I can't seem to figure out how to retain the values in a drop down menu the same way I have for text fields. Below is the code that im using that I thought would work however it isnt working, the values of the drop down menu (if there was an error) are going back to the values from the database. Heres the code... <option value="Psychopathic" <?php if ((isset($_POST['category']))&&($_POST['category'] == 'Psychopathic')) { echo ' selected=selected'; } else if ((isset($category))&&($category == 'Psychopathic')) { echo ' selected=selected'; } ?>>Psychopathic</option> Does anybody know what i am doing wrong and how i can fix this problem? I understand what i need to do but i cant seem to get the code to do what i want to do and thats to retain values of a drop down menu when the page is returned with an error. Any help would be much appreciated. AJay Hi all, i need some help in retaining the values in an <option> textbox.. I have found a code to loop the date online, and use it for Javascript jump menu, but i have no ideas how to retain the option.. here are my codes(in red), $year1 = date('Y'); $month1 = date('m'); $day1 = date('j'); $day1 = $day1 + 1; $year2 = date('Y') + 2; $month2 = date('m'); $day2 = date('j'); $start_date = "$year1-$month1-$day1"; $end_date = "$year2-$month2-$day2"; $date = mktime(0,0,0,$month1,$day1,$year1); //Gets Unix timestamp START DATE $date1 = mktime(0,0,0,$month2,$day2,$year2); //Gets Unix timestamp END DATE $difference = $date1-$date; //Calcuates Difference $daysago = floor($difference /60/60/24); //Calculates Days Old $i = 0; while ($i <= $daysago +1) { if ($i != 0) { $date = $date + 86400; } else { $date = $date - 86400; } $yy1 = date('Y',$date); $mm1 = date('m',$date); $dd1 = date('d',$date); $date3 = "$yy1-$mm1-$dd1" ; echo "<option value=\"test1234.php?m=$mm1&y=$yy1&d=$dd1\" "; echo ">".$date3 ."</option>"; $i++; } i know that i have to something selected, but i dun understand how this set of date code loop which left me helpless. Hey, Im needing some help with an update form that I have created using PHP/MySQL. Basically the form is working great (updating records, retrieving records and showing errors) but there is a problem with the errors. If there are no errors and I edit the existing text input values, the database updates fine. However if I edit the existing text input values and there is an error, the edited input values dont save, they revert back to the values of the database. I understand why this is happening, its because the text inputs are set to show the values of the database so if i edit the existing values and an error occurs or the page is refreshed, the values revert back to the database values. However id like it so that if any text in the text field have been edited and an error occurs, the text stays to how it is until the user by passes any errors and then the database is updated. Hopefully this makes sense. I have attached the php page just incase anybody wants to look into it but any help would be much appreciated! Also, im not looking for someone to just to fix this for me but if someone knows my problem and can guide me in the right direction, that would be great. Hey guys im having a issue with getting a radio group check box to work. Not sure what im doing wrong this is giving me a fatal error. Wanting to make it where only one box can be checked at a time. and when the attack from button is hit it assigns the value to $defender_planet <input type="checkbox" name="defender_planet" value="58"/> <input type="checkbox" name="defender_planet" value="59" /> <input type="checkbox" name="defender_planet" value="60" /> if(isset($_POST['attack_from'])) { $defender_planet = $this->input->post('defender_planet'); $planet3 = "SELECT defender_planet FROM travel WHERE defender_planet = '" .($defender_planet')."'"; $planet2 = mysql_query($planet3) or die(mysql_error()); $planet1 = mysql_fetch_array($planet2); $_SESSION['attacking_from'] = $planet1['defender_planet']; header("Location: attack.php"); exit(); } Hi guys...I need some help in matching data from results of checkboxs and radio buttons. My Intentions: There are 3 radio buttons and 8 check boxes. Users can select any one but cannot don't select at all. I separate the calss and categories because for classes, users can only select 1 option whereas for categories users can select many. For example, User select class 1 but do not select anything else and click submit...the system will then retrieve that he selected and check the data base if he have the pre requisites to allow him to go through. Coding for my form: Code: [Select] <form id="applicationoptions" method="post" action="s_apply_now.php"> <div id="optionshead">Class :</div> <div id="classoptions"> <input type="radio" name="class" value="1" /> Class 1 Permit <input type="radio" name="class" value="2" /> Class 2 Permit <input type="radio" name="class" value="3" /> Class 3 Permit </div> <div id="optionshead2">Categories :</div> <div id="catoptions"> <input type="checkbox" name="cat" value="1" /> CAT 2PG <input type="checkbox" name="cat" value="2" /> CAT 1OR <input type="checkbox" name="cat" value="3" /> CAT 2TT <br/><br/> <input type="checkbox" name="cat" value="4" /> CAT 3PG <input type="checkbox" name="cat" value="5" /> CAT 2OR <input type="checkbox" name="cat" value="6" /> CAT 3TT <br/><br/> <input type="checkbox" name="cat" value="7" /> CAT 4PG <input type="checkbox" name="cat" value="8" /> CAT 3OR </div> <div class="applynext"> <input class="applynextbutton" type="submit" name="applynextbutton" value="PROCEED" /> </div> </form> Lets say if user do not select any class, but select CAT 3PG, system will check if user have the pre-requisites before proceeding to next step. Any one can help me or give me hints?? most importantly is i do not know how to retreieve the values selected from the form. Is it possible to do it using php or must i hunt for javascript's script?? Thanks in advance guys...greatly appreciate. Hi. Im pretty sure this is easy but ive been trying for hours and looked all over the web but cant seem to do it. I have information submitted to my database which I then retrieve on another page. I retrieve the landlord name and group the same values together plus retrieve an overall rating which I average and sort by. This works and is done using: Code: [Select] $sql="SELECT landlord_name, AVG(overall) FROM $tbl_name GROUP BY landlord_name ORDER BY AVG(overall) DESC"; $result=mysql_query($sql); // Start looping rows in mysql database. while($rows=mysql_fetch_array($result)){ Where Im finding it difficult though is I have 5 radio buttons with values from 1-5 and want one of them to be checked if the value matches the averaged overall rating. What I've tried is: Code: [Select] if (AVG(overall)==1){ $check1="checked";} if (AVG(overall)==2){ $check2="checked";} if (AVG(overall)==3){ $check3="checked";} if (AVG(overall)==4){ $check4="checked";} if (AVG(overall)==5){ $check5="checked";} then in the form: Code: [Select] <table width="600" border="1" cellspacing="0" cellpadding="3"> <tr> <td><? echo $rows['landlord_name']; ?></td> <td><div class="avg"><form> <input type="radio" value="1" disabled="disabled" checked= "<? $check1 ?>" /> <input type="radio" value="2" disabled="disabled" checked= "<? $check2 ?>" /> <input type="radio" value="3" disabled="disabled" checked= "<? $check3 ?>" /> <input type="radio" value="4" disabled="disabled" checked= "<? $check4 ?>" /> <input type="radio" value="5" disabled="disabled" checked= "<? $check5 ?>"/> </form></div> </td> </tr> </table> To make it a bit more difficult, the AVG(overall) value will not always be an integer from 1-5 and will need to be rounded to the closest one. Think i can use ROUND for this but dont know how to put it in. Thanks for your help in advance. As you can probably tell im new to php and still learning the basics. I have a form that contains radio buttons and when it is submitted the content of the form are added to a database. I was wondering how you get the values of radio boxes when submitting the form. I have the following radio buttons and when submitting I use "$_POST['article_type']" but this doesn't seem to work. Thanks for any help. <label>PDF Article</label><input name="article_type" value="pdf" type="radio" /> <label>Video Webcast</label><input name="article_type" value="webcast" type="radio" /> <label>Podcast</label><input name="article_type" value="podcast" type="radio" /> Hey! I have it so users can submit info to my site. They have to check some check boxes and radio buttons. I want them to be able to edit this information, so I want to have the data pulled from the MySQL database and have the correct radio button selected (and the text bolded). So I'm thinking some sort of array to check for each value in the database... but I don't really know. There are a few groups of radio boxes and check boxes but here is an example of one. Code: [Select] <input type="radio" name="stage" value="Stage 1" /> Stage 1 <input type="radio" name="stage" value="Stage 2" /> Stage 2 <input type="radio" name="stage" value="Stage 3" /> Stage 3 The information is pulled from the database like this: Code: [Select] $res=mysql_query("SELECT * FROM ACTIVE WHERE INDEX_ID=$id"); if(mysql_num_rows($res)==0) echo "There is no data in the table <br /> <br />"; else { for($i=0;$i<mysql_num_rows($res);$i++) { $row=mysql_fetch_assoc($res); } } So when I pull information (lets say I want to echo it) it'd look like this: Code: [Select] $row[STAGE] The value for the stage selection can only be Stage 1, Stage 2 or Stage 3 so I need it to be selected when the page loads. Thanks! I have several radio buttons (dynamically generated) and I want to use the selected value in a MySql query WHERE clause. Is it possible? Hey Guys. I have a quick question. Should i "prep" input values coming from a radio or checkbox input field? Can an SQL injection occur through those 2 input fields, or is it only text fields?
I am trying to have the text alongside the radio button trigger the radio button (cannot use < a href ) e.g. () Trigger with this text The closest I have found is <label for="r1"><input type="radio" name="group1" id="r1" value="1" /> button one</label> But it does not seem to work? Any help greatly appreciated Hello, I had 3 radio buttons with the same name, well, I had created 3 text box that are next to those 3 radio buttons. When I click save to the form, I need to know which radio button had been pressed, so that I can detect & retrieve its value. Any help? Thanks I have a function to display some images and allow a user to select a choice via a radio button.The value is then passed to another function. I have 2 problems My selection is not being passed back and I cant assign the value to a query sring in a link to another page. On the form do i need to add checked? Any help appreciated. Code: [Select] function cover() { echo'<h2>Please upload your book cover or choose one from the selection</h2> <p>All book ideas require a cover. Your choice can be changed at a later date.</p>'; //process selection of cover if (isset($_POST['submit'])) { $coverID=$_POST['cover']; echo $coverID; ?>   <ul><li class="demo-menu-link"><a href="?page=submenu7&coverID=$coverID">Finnished Cover</a></li></ul><?php exit(); } else{ echo "not Submitted"; } global $wpdb; $query = "select * from wp_cover"; $result = mysql_query($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); echo mysql_error(); if (!$result){ return false; } echo'<div class="wrap"><p>choose from one of the covers below</p></div>'; ?><form action="<?php $_SERVER['PHP_SELF'] ?>" method="POST" id="cover" enctype="multipart/form-data"> <table><tr><?php /* display picture and radio button */ while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $coverID=$row['coverID']; echo"<img src=\"/wordpress_3/wp-content/plugins/Authors2/jackets/{$row['pix']}\" />"; echo"<td>"; echo $coverID; echo "<Input type = 'Radio' Name ='cover' value= '$coverID'/>"; ?> </tr></table> <input type=submit value=submit> </form><?php } } |