Jump to content

chuddyuk

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by chuddyuk

  1. Im making a news system with catergories. my database lists these catergories. and in the record if there is a "1" in for example the business news record then that is the chosen catergory which means the rest will have "0"s. i want to input the data now through a form not manually into the records. im just getting stuck with how to make it add the "1" when the radio button is selected and submited any ideas? the catergories and wat they are called in the database are::: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Name = database feild name Business = business Student Union = su Employer News = employers 16 - 19 Years = sixteen Adult News = adults [/quote] thanks in advance for any help!!
  2. Works a Treat thanks !!!!Knew it was something really simple!!!!
  3. I have a form which submits info into a database, it is very simple at the moment once i have solved this problem i will add the rest of my feilds. It submits, but on the variable name like it will show $title an $news in the database, i know its somethin v simple but cant figure it out please help, here is the page:: [code] <? if(isset($_GET['commented'])) { // Tell the user it has been submitted (optional) echo('Your comment has been posted.'); include "common.php"; // Set global variables to easier names $titles = $_GET['title']; $new = $_GET['news']; // Connect to Mysql, select the correct database, and run teh query which adds the data gathered from the form into the database mysql_connect($dbhost,$dbuser,$dbpasswd) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $add_all = 'INSERT INTO `news` (`title`, `news`) VALUES (\'$titles\', \'$new\')'; mysql_query($add_all) or die(mysql_error()); } else { // If the form has not been submitted, display it! ?> <form method="get" action="<?php echo $PHP_SELF?>"> Title : <input type='text' name='title'><br><br> News : <input type='textarea' name='news'><br><br> <input type='hidden' name='commented' value='set'> <input name='submit' type='submit' value='Post your comment'> </form> <? } ?> [/code]Thanks
×
×
  • 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.