PHP + MySQL Database Insert Each Line
I know I've seen this on Stack Overflow before, but not sure how I would put it to use for myself. So basically I'm creating a generator. All I need done, is to figure out how to insert a new row into my database.
So basically, I have a textbox & submit button, when I click the submit button each line in the textarea will be inserted as a whole new row in the database.
`
<textarea rows="4" cols="50" name="insert">
</textarea>
<br />
<input type="submit" value="Enter" name="submit" />
`
Answer
Solution:
Let's say you have a table called
tblname
with columntext
, and you're sending the form value to$_POST['insert']
. Usingmysqli
(andpdo
is really similar):