dabbsy Posted September 27, 2006 Share Posted September 27, 2006 This is probably bread and butter to you all, but I'm new to php, so you'll have to bear with me!!!I've got a form which has several text areas in, which is defined within a form (a small part of the code is shown at the bottom) - I can happily get this to populate the database with new information using POST - if (isset($_POST['submit'])). The next stage is for the user to select an application name from a list (pulled back from the database) and include it in a form so the user can select from it. The code for this is below. Both pieces work individually, but I can't get the list of application to be displayed and work within a form. Can anyone help with the syntax or am I approaching it in the wrong way?[b]Code to pull back the application name[/b]echo '<p><b>Select application:</b> <select name="app_name[]" size="3">';$query = "SELECT application_id, application_name FROM contacts ORDER BY application_name ASC";$result = mysql_query ($query); // Run the query.while ($row = mysql_fetch_array ($result, MYSQL_NUM)) { echo '<option value=\"$row[0]\"'; echo ">$row[1]</option>\n'";}echo '</select></p>';mysql_free_result ($result); // Free up the resources. [b]Form code[/b] (only one text field shown to avoid pasting a load of code)<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"> <p> Application Name:<br /> <input type="text" name="app_name" size="25" maxlength="25" value="" /> </p> <p> <p> <input type="submit" name="submit" value="Submit!" /> </p></form>Hope someone can help!Thanks, J Quote Link to comment Share on other sites More sharing options...
jvrothjr Posted September 27, 2006 Share Posted September 27, 2006 your value is set to nothing to display the value you need to use $_POST['varname'][code=php:0]<input type="text" name="app_name" size="25" maxlength="25" value="" />[/code] Quote Link to comment Share on other sites More sharing options...
dabbsy Posted September 27, 2006 Author Share Posted September 27, 2006 The problem I'm having is with the syntax to drop into the form area - i.e. what I need to put into that value "" field. I just can't work out how to get it into the form :-[ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.