Jump to content

Gilwren

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Gilwren

  1. Hi Guys I am a total newbie to PHP and coding for that matter and have recently done a 10 week basic course in PHP. So I should be able to answer this question but I am stuck please help. My code looks like this; <?php if (isset($_POST['britbatID'])) { header("Location:editbritbat.php?pageID=".$_POST['britbatID'].""); } ?> <div id="category"> <h2>Edit a British Battalion</h2> <form action="" method="post"> <fieldset> <div class="selection"><label for="BritbatID">Edit British Battalion</label> <select name="britbatID"> <option value="<?php echo $row_britbatname['britbatID'];?>"><?php echo $row_britbatname['britbatname'];?></option> <?php do { ?> <option value="<?php echo $row_britbatname['britbatID'];?>"><?php echo $row_britbatname['britbatname'];?></option> <?php } while ($row_britbatname = mysql_fetch_assoc($rsbritbatname));?>"> </select> <input name="<?php if (isset($_POST['britbatID'])) { header("Location:editbritbat.php");} ?>britbatID"submitBat" class="button" type="submit" value="edit this British Battalion"> </div> <!-- end selection--></div> However when I use the editbritbat.php file it fails to have any value for $britbatID. The relevant code in my editbritbat.php file is; <?php if (isset($_GET['britbatID'])) { $britbatID = $_GET['britbatID']; }?> <?php mysql_select_db($database_britishforces, $britishforces); $query_britbatname = "SELECT * FROM battalions WHERE battalions.britbatID = '$britbatID'"; $rsbritbatname = mysql_query($query_britbatname, $britishforces) or die(mysql_error()); $row_britbatname = mysql_fetch_assoc($rsbritbatname); ?> Every time I run editbritbat is fails and states :Undefined variable: britbatID in C:\xampp\htdocs\BFWIIFD\editbritbat.php on line 9 I am sure this is an easy answer but I am stuck and don't get what I am doing wrong. Cheers Richard
×
×
  • 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.