|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Passing Form Code into a Textarea
I wrote a site for an organization here at school, and I put together a quick backend (PHP/mySQL. Surprise!) so that the non-technorati could edit the copy on the pages without help. One of the pages invites readers to respond to the articles on the site, so naturally it has some form code. The backend page yanks the code from the database and puts it between <textarea></textarea> tags so that the user can edit it.
The problem is that the browser can't properly distinguish between the code for the submit buttons on the page to be edited and the code for the submit buttons in the real, live form that actually the work. Here's what appears: (Inside textarea) HTML for text HTML for form, up to code for form buttons (After textarea) Two form buttons that shouldn't have appeared Two form buttons that should have Is there any sort of clever way to make this work properly? I could hard-code the form into the page.php file and use an if statement to look for a flag, but that sort of defeats the purpose. I'm looking for something a bit more elegant. The interesting part of the HTML is below. <textarea name = "code" rows = 20 cols = 80> <p> Some nice text for people to read </p> <form method = POST action = "http://theurl.com"> <table cellpadding = 0 cellspacing = 0 align = "center"> <tr><td>Name:</td><td><input type = "text" size = 30 name = "sentby"></td></tr> <tr><td>Email Address:</td><td><input type = "text" size = 30 name = "email"></td></tr> <tr><td>Title of Article:</td><td><input type = "text" size = 50 name = "article"></td></tr> <tr><td>Your Response:</td><td></td></tr> <tr><td colspan = 2><textarea name = "text" cols = 49 rows = 10></textarea></td></tr> </table> <center> <input type = "submit" value = "Send"> <input type = "reset" value = "Reset"> </center> </form> <tr><td> </textarea> |
|
#2
|
|||
|
|||
|
RE: Passing Form Code into a Textarea
Whoops, sorry. The HTML above is what the php script generates for the user to see, and I left out some of the relevant bits. Let's try again:
<form method = "POST" action = "insertpage.php"> <table> <tr><td>Page Title (For Admin Menu Only):</td><td><input type = "text" size = 63 name = "menuname" value = "Submissions"></td></tr> </table> Article Code:<br> <textarea name = "code" rows = 20 cols = 80> <p> The copy for the end-users' page </p> <form method = POST action = "http://www.princeton.edu/cgi-bin/Princeton/formreply?mfmurray@princeton.edu+mmacdona@princeto n.edu"> <table cellpadding = 0 cellspacing = 0 align = "center"> <tr><td>Name:</td><td><input type = "text" size = 30 name = "sentby"></td></tr> <tr><td>Email Address:</td><td><input type = "text" size = 30 name = "email"></td></tr> <tr><td>Title of Article:</td><td><input type = "text" size = 50 name = "article"></td></tr> <tr><td>Your Response:</td><td></td></tr> <tr><td colspan = 2><textarea name = "text" cols = 49 rows = 10></textarea></td></tr> </table> <center> <input type = "submit" value = "Send"> <input type = "reset" value = "Reset"> </center> </form> <tr><td> </textarea> <p> <input type = "hidden" name = "id" value = "2"> <input type = "submit" value = "Submit"> <input type = "submit" value = "Cancel"> </p> </form> |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Passing Form Code into a Textarea |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|