Hi Jeromie,
Thanks for you response. Can you explain where in the code I should add $_POST [picplace]; , please? Should it be in the select name or option value? I tried you suggestion and managed to extract the correct value from the select box to another PHP page. So the form is OK. It's just the transition into the database where the problem is and I guess it's linked to me missing out the $POST variable in the <FORM> Nearly there - thanks all for you responses. Chris --- In [email protected], Jeromie Clark <[EMAIL PROTECTED]> wrote: > Chris - > > The code you're generating your form with looks okay ($PHP_SELF should > probably be $_SERVER['PHP_SELF']), but it's hard to know. > Can you post the HTML that's being rendered from this form? > > Also, here are a couple other suggestions: > > On the receiving end (whatever's processing this form submission), do > something like: > <?php > var_dump($_POST); > ?> > > You should get output that looks like: > array(['picplace']=>string(xx)"Some Location"); > > If you get this, then your HTML form is working successfully -- the data > is getting to your script from the form. > Now you know that the problem is in this page. > > A good way to do this is to move the var_dump to right before where > you're using it in your code. If you still see the output, you haven't > overwritten the data, so you're probably misspelling the variable name > or calling $picplace instead of $_POST['picplace'] and just aren't > seeing it, because it doesn't look wrong. > > I will totally stare at a mistake like that for an hour and probably > never see it until I work my way through the script making sure my > variable gets from point A to point B. > > If you're not getting output, your form is screwed up, and you should > look at the HTML source to make sure your values are actually there, and > that your syntax is correct. > > Anyway, do those things -- if you're still stuck, give me a little more > to go on, and I'll try and help you out. :) > > Best, > Jeromie > > > > >Hi, > > > >Just wondering if you could help me out with a problem I can't seem to > >solve. I have a MYSQL/PHP photo gallery website which I'm currently > >developing. > > > >In order to add records I've created a page with an HTML form which > >inserts records into the MYSQL database. I've had no problems > >inserting data from text <INPUT> type fields. However, when I come to > >add data from a <SELECT> drop down box, it isn't working. For some > >reason - & regardless of the option picked when you submit the form - > >the data entered is always the last value in the list. > > > >Has anyone any ideas? Grateful for any tips/solutions. The relevent > >code is below: > > > ><?PHP > >$query1 = "SELECT DISTINCT picplace FROM pictureplace ORDER BY picplace"; > >$result1 = mysql_query($query1) > >or die ("Couldn't execute query1."); > >?> > > > ><form action='<?$PHP_SELF?>' method='post'> > ><select name='picplace'> > ><? > > > >while ($row = mysql_fetch_array($result1)) > > { > > extract($row); > > echo "<option value='$picplace'>$picplace \n"; > > > > > > } > > echo "</select> \n"; > >?> > > > ><br /> > ><input type='submit' value='>' /> > ></form> > > > >Thanks, > >Chris > > > > > > > > > > > > > >The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web database possibilities through group learning. > >Yahoo! Groups Links > > > > > > > > > > > > > > > > > > The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web database possibilities through group learning. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php_mysql/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
