Forum Moderators: coopster

Message Too Old, No Replies

summernote and passing its value a PHP page

pass value from one page to the next

         

janprocnj

3:04 pm on Nov 11, 2018 (gmt 0)

5+ Year Member



I am using summernote (bootstrap wysiwyg text area) and trying to pass its value to a PHP page to insert its value into the database. I am not sure how to grab its value on the next page. All the other form fields are standard, for example -->

<input type="text" maxlength="50" class="form-control" name="fname" placeholder="Enter first name" required>
..... on the next PHP page I would just create a variable such as $firstname=$_POST['fname'];

but the code for summernote on the registration page is the following and I don't see what value to use or how to code it. Any help is appreciated -->

<div id="summernote"></div>
<script>
$('#summernote').summernote({
placeholder: 'Hello bootstrap 4',
tabsize: 2,
height: 100
});
</script>
..

justpassing

3:42 pm on Nov 11, 2018 (gmt 0)

5+ Year Member Top Contributors Of The Month



on your PHP page, do a:
echo "<pre>"; print_r($_POST); echo "</pre>";

You'll see which post variables are populated with what.

janprocnj

8:37 pm on Nov 11, 2018 (gmt 0)

5+ Year Member



It is adding the "files" field name at the bottom and I get this output, but it is not passing anything over, even though I am putting text in the summernote field. I am very new to this. Anything else to try? thanks

Array
(
[fname] => first
[lname] => last
[cell] => 555-555-5555
[email] => email@email.com
[fospecialty1] => test 1
[fospecialty2] => test 2
[files] =>
)

robzilla

11:08 pm on Nov 11, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



A <div> is not a form element like <input> or <textarea>, so you won't see its contents in the POST data.

So just use <textarea> with id="summernote", instead of the <div>, and place it within the <form></form> tags.

<textarea id="summernote" name="message"></textarea>

Also note that if your form accepts files, PHP will store those in $_FILES instead of $_POST.

janprocnj

1:36 pm on Nov 12, 2018 (gmt 0)

5+ Year Member



I am not sure where to put that textarea code. If I put it below it just adds another text area field without the wysiwyg (see code below). If I embed it in the code, it puts another text area box in the summernote wysiwyg. any idea?

<div id="summernote" ></div>
<script>
$('#summernote').summernote({
placeholder: 'Hello bootstrap 4',
tabsize: 2,
height: 200
});
</script>
<textarea id="summernote" name="message"></textarea>

robzilla

3:52 pm on Nov 12, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You put it among the other input fields between the <form></form> tags. The POST data you posted above contains fields like "fname" and "lname", so you probably have some <input> elements on the page. This is also described in the documentation [summernote.org] for Summernote.

janprocnj

7:16 pm on Nov 12, 2018 (gmt 0)

5+ Year Member



Yes, I did everything according to their samples and no luck. Can you recommend another wysiwyg text area option?

robzilla

7:45 pm on Nov 12, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Did you remove the <div id="summernote"></div> and add the <textarea id="summernote" name="message"></textarea> within the <form></form> tags?

It would help if you could post a fuller code sample, one that includes the form. You can exemplify any identifiable information if you like.

janprocnj

10:16 pm on Nov 12, 2018 (gmt 0)

5+ Year Member



I believe I have it working now, by changing the code to -->

<textarea id="summernote" name="message"> </textarea>
<script>
$('#summernote').summernote({
placeholder: 'Hello bootstrap 4',
tabsize: 2,
height: 200
});
</script>


I will continue testing... THANKS!