soma56 Posted July 3, 2010 Share Posted July 3, 2010 I'm familiar with getting/using my output from a <textarea> like so: <form action="" method="post"> <table width="500"> <tr><td>What's your name?<input name="name" type="text" /></td></tr> <tr><td><input type=Submit value="Enter Name" name="Submit"></td></tr> </table></form> <?PHP echo "<textarea name=\"mytextbox\">"; unset($name); if (isset($_POST['Submit'])) { echo $name; } echo "</textarea>"; //Use 'name' for other php functions ?> However, can this be done with a CSS box? Here's an example: <style> div#status {position:absolute; overflow:auto; height:250px; background-color:#999; top:230px; font-family:Verdana, Geneva, sans-serif; font-size:10px; color:#333; margin-left:540px; width:240px; border:2px lightblue solid;} </style> <html> <body> <form action="" method="post"> <table width="500"> <tr><td>What's your name?<input name="name" type="text" /></td></tr> <tr><td><input type=Submit value="Enter Name" name="Submit"></td></tr> </table></form> <?PHP echo "<div id=\"status\">"; unset($name); if (isset($_POST['Submit'])) { echo $name; } echo "</div>"; //Use 'status' for other php functions ?> Link to comment https://forums.phpfreaks.com/topic/206646-grabbing-from-no-problem-but-what-about-a-css-box/ Share on other sites More sharing options...
soma56 Posted July 3, 2010 Author Share Posted July 3, 2010 I still can't figure this out. Here's a correction on the original code: <form action="" method="post"> <table width="500"> <tr><td>What's your name?<input name="name" type="text" /></td></tr> <tr><td><input type=Submit value="Enter Name" name="Submit"></td></tr> </table></form> <?PHP echo "<textarea name=\"mytextbox\">"; unset($name); if (isset($_POST['Submit'])) { $name = trim($_POST["name"]); echo $name; } echo "</textarea>"; //Use 'name' for other php functions ?> It seems PHP is able to grab everything from a text box based on the <input name="name" attribute. Does any such element work for div tags in CSS? I have everything styled in CSS with divs for boxes however the only way to use PHP as a means of playing with the output is by grabbing the name within a <textarea>. I tried wrapping a visibility:hidden; within the code but that made everything hidden. I saw somewhere that someone assigned a name to a div tag <div id="mydiv" name="myname" however I wasn't able to use the contents in a similar fashion as a <textarea> I also tried wrapping the textarea within the CSS however that made everything look terrible. Link to comment https://forums.phpfreaks.com/topic/206646-grabbing-from-no-problem-but-what-about-a-css-box/#findComment-1080827 Share on other sites More sharing options...
kenrbnsn Posted July 4, 2010 Share Posted July 4, 2010 PHP doesn't "grab" data from a screen, it is sent data from a form. PHP doesn't know anything about what's on the screen. If you want to send data to PHP from other places on the screen, you would have to use Javascript and send the data via AJAX. Ken Link to comment https://forums.phpfreaks.com/topic/206646-grabbing-from-no-problem-but-what-about-a-css-box/#findComment-1080910 Share on other sites More sharing options...
soma56 Posted July 5, 2010 Author Share Posted July 5, 2010 Thanks for your reply. I think I thought about this one too much. Assigning the css styles directly to the <textarea> solved it. Link to comment https://forums.phpfreaks.com/topic/206646-grabbing-from-no-problem-but-what-about-a-css-box/#findComment-1081120 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.