Jump to content

MarniDawg

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

MarniDawg's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ugh LOL! Wow that's what I get for hours of looking at the code! Anyway works like a charm now. Thank you very much!
  2. First of all please forgive any ignorance on my part as I'm a newbie at writing my own code. Now I've managed to create my database and an html form with very few problems. I can get my text fields to insert data into the database with no problem. However I'm trying to get these radio buttons to insert data with no luck. It simply inserts blank data.. It's not NULL, just blank. I need them to insert a path to an image so that it can be used to display on a page that shows all data. This is the gender area that I'm having a problem with by the way. This is what I have for my form file: <?php include("header.html"); include("includes/config.php"); switch($dgender) { case 'female': $dgender="images/female.png"; break; case 'male': $dgender="images/male.png"; break; } echo "<tr><td id='main'> <div class='maincont'> <center> <br> <div class='hr'></div> <br><br> <table><tr><td align='left'> <form action='doadd.php' method='post'> Dragon Name: </td><td align='right'> <input type='text' name='Name' /></td></tr> <tr><td align='left'>Dragon Code: </td><td align='right'> <input type='text' name='Code' /></td></tr> <tr><td align='left'>Owner: </td><td align='right'> <input type='text' name='Owner' /></td></tr> <tr><td align='left'>Mother Code: </td><td align='right'> <input type='text' name='Mother' /></td></tr> <tr><td align='left'>Father Code: </td><td align='right'> <input type='text' name='Father' /></td></tr> <tr><td align='left'>Generation: </td><td align='right'> <input type='text' name='Generation' /></td></tr> <tr><td align='center' colspan='2'> <input type='radio' name='dgender' value='female'>Female <input type='radio' name='dgender' value='male'>Male <tr><td align='center' colspan='2' ><input type='submit' /><br> </form> </td></tr></table> <br><br> <div class='hr'></div> <br><br> </center> </td></tr>"; include("footer.html"); ?> This is what I have for my action file: <?php include("header.html"); include("includes/config.php"); $dgender=$_POST[Gender]; $dname=$_POST[Name]; $dcode=$_POST[Code]; $downer=$_POST[Owner]; $dgen=$_POST[Generation]; $dmom=$_POST[Mother]; $ddad=$_POST[Father]; switch($dgender) { case 'female': $dgender="images/female.png"; break; case 'male': $dgender="images/male.png"; break; } $sql="INSERT INTO Dragons (Name, Code, Owner, Generation, Mother, Father, Gender) VALUES ('$dname','$dname','$downer','$dgen','$dmom','$ddad','$dgender')"; if (!mysql_query($sql,$connect)) { die('Error: ' . mysql_error()); } echo "<tr><td id='main'> <div class='maincont'> <center> <br> <div class='hr'></div> <br><br> Dragon Added!<br><a href='adddragon.php'>Add Another?</a><br><br>Or<br><br><a href='dragons.php'>View Dragons</a> <br><br> <div class='hr'></div> <br><br> </center> </td></tr>"; include("footer.html"); mysql_close($connect); ?> Please help point me in the right direction. I've googled this to death and been working on it with no luck since yesterday. I feel there's something I'm missing. Usually I'm very good at teaching myself this stuff LOL! Thanks in advance for any help![/code]
×
×
  • 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.