zaniac Posted August 26, 2007 Share Posted August 26, 2007 I have a very primitive version of a database set up using PHP/MySQL. I have a made a simple table with the columns 'name', 'age', 'address' & 'email'. The 'address' column has more tha one variable which is posted to it via a form (for example $_POST['street'] and $_POST['country']). When displaying the table on screen the field in the 'address' column has all the variables inline and all joined up. I was hoping to have the column display each $_POST variable on a new line, so it could appear like below......Example 135 Halgar Field CourtDunstableEnglandand not like what it currently displaying below..........Example 235 Halgar Field CourtDunstableEnglandAlso I am having problems getting data to display in the database from <select> tags and checkbox options users have submitted through the form. ------------------------------------------------------------------------------------ So my 2 questions are:1) Is it possible to have more than 1 $post variable in a MySQL table column and have each of those variables displayed on a new line like in Example 2?&2) How do I get <select> and checkbox options in a submitted form to display on a MySQL database?If you can help, you'd be a golden star Link to comment Share on other sites More sharing options...
justsomeguy Posted August 26, 2007 Share Posted August 26, 2007 Is it possible to have more than 1 $post variable in a MySQL table column and have each of those variables displayed on a new line like in Example 2?It doesn't matter that these happen to be variables in the $_POST array, and it doesn't matter that you are storing data in a MySQL database. All you're dealing with are strings. You can insert a newline with \n and then use nl2br to convert the newlines into HTML breaks, or you can just insert a <br> HTML tag.Select and checkbox values aren't any different then any other form value.<input type="checkbox" name="check" value="1">If they checked the box, then $_POST['check'] will be "1".<select name="list"><option value="1">1</option></select>If they choose option 1 then $_POST['list'] will be "1". Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.