Jump to content

Can you look over my code to see why it is not working?


pioneerx01

Recommended Posts

Hi,

 

I have a registration page (that one works fine) where users register with minimal personal info. They also get to rate 8 categories (see bellow) 1-5. Once they hit submit it all goes into database just fine.

 

I have also created a page for myself where I can recall all data for any registration. All data gets pulled from database correctly. When I change variables and hit submit it does not update the record in the database. I get no errors from the script, but I have narrowed the problem to the recall of categories and the ratings. If I remove them from the update script other info gets stored correctly.

 

Here is how I recall the 8 categories and their user submitted ratings (as well as other info):

$category = array('AS','BE','BI','CH','CS','EG','EV','PH');
foreach ($category as $cat)
{
if ($cat == 'AS') $cat_name = 'Animal Sciences';
if ($cat == 'BE') $cat_name = 'Behavioral & Social Sciences';
if ($cat == 'BI') $cat_name = 'Biology';
if ($cat == 'CH') $cat_name = 'Chemistry';
if ($cat == 'CS') $cat_name = 'Computer Science';
if ($cat == 'EG') $cat_name = 'Engineering';
if ($cat == 'EV') $cat_name = 'Environmental Sciences';
if ($cat == 'PH') $cat_name = 'Physical Sciences';
echo"
  <tr>
    <td>$cat_name</td>";
$numbers = array('0','1','2','3','4','5');
foreach ($numbers as $no)
{
   echo "<td><input type='radio' name='$cat' value='$no'"; if ($row[$cat] == $no) echo " checked/>"; else echo "/>"; echo"$no</td>";
}}

 

And here is how I update the record (as well as other info not listed):

 


mysql_query("UPDATE registrations SET 
AS = '$_POST[AS]', 
BE = '$_POST[bE]', 
BI = '$_POST[bI]', 
CH = '$_POST[CH]', 
CS = '$_POST[CS]', 
EG = '$_POST[EG]', 
EV = '$_POST[EV]', 
PH = '$_POST[PH]'
WHERE ID = '$_POST[iD]'
");

 

Something in my recall code is creating issued for me, but I have no idea what.

 

Thanks

Archived

This topic is now archived and is closed to further replies.

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