PHP - Alert Textarea Text When Pressing Return Key
Each status has a comment textarea.
How can I get it to alert what the user has typed in the textarea when the return key is pressed.
The textarea in the PHP loop is like this:
<textarea class='commentbox' id='" . $thisid . "'></textarea>The reason why I am asking this and not how to save it to the database etc is because I think I will be able to do that. Thanks, Similar Tutorials
I Need To Show Data After Pressing Browser's Back Button [accidentally Pressed Enter Instead Of Tab]
I cannot figure out how to retain the inputted information once submit is pressed. I want the user to enter their first name, last name, hours of work, and hourly pay rate. Then, I want them to press submit. Their pay will be calculated and displayed, but I still want their inputted information to be visible. How can I do that?? Here is my code: Code: [Select] <html> <head> <?php $pay = $_POST['pay']; $hours = $_POST['hours']; $extra = $_POST['extra']; $rate = $_POST['rate']; if ($hours > 40){ $extra=$hours-40; $hours=40; $pay=($extra*1.5*$rate)+($hours*$rate); } else { $pay=$hours*$rate; } echo "Your pay is: <br /> $ $pay <br />" ; ?> </head> <body> <form method='post' action='pay2.php'> First Name: <input type='text' name='first'><br/> Last Name: <input type='text' name='last'><br/> Hours of Work: <input type='text' name='hours'><br/> Hourly Pay Rate: <input type='text' name='rate'><br/> <input type='submit' value='submit'> </form> </body> </html> Hi
I'm new to wordpress and PHP, I'm not a developer and I only understand HTML. All I've learnt so far about wordpress is from youtube, so apologies in advance for all the questions.
In the header where it says "Get Register", i want to change it to just say "Register".
I'm using firebug and Firefox browser to find the file, to edit the above request.
so far, its told me the text i need to edit, is in custom.css?ver=1
on line 329
I found the file custome.css, but how do i edit custom.css?ver=1 please?
Help guys!!! Basically i want to return/display User OS info/name from input field... Below my unfinished scripts.. <?php $user_agent = $_SERVER['HTTP_USER_AGENT']; function getOS() { global $user_agent; $os_platform = "Unknown OS Platform"; $os_array = array( '/windows nt 6.2/i' => 'Windows 8', '/windows nt 6.1/i' => 'Windows 7', '/windows nt 6.0/i' => 'Windows Vista', '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', '/windows nt 5.1/i' => 'Windows XP', '/windows xp/i' => 'Windows XP', '/windows nt 5.0/i' => 'Windows 2000', '/windows me/i' => 'Windows ME', '/win98/i' => 'Windows 98', '/win95/i' => 'Windows 95', '/win16/i' => 'Windows 3.11', '/macintosh|mac os x/i' => 'Mac OS X', '/mac_powerpc/i' => 'Mac OS 9', '/linux/i' => 'Linux', '/ubuntu/i' => 'Ubuntu', '/iphone/i' => 'iPhone', '/ipod/i' => 'iPod', '/ipad/i' => 'iPad', '/android/i' => 'Android', '/blackberry/i' => 'BlackBerry', '/webos/i' => 'Mobile' ); foreach ($os_array as $regex => $value) { if (preg_match($regex, $user_agent)) { $os_platform = $value; } } return $os_platform; } function getBrowser() { global $user_agent; $browser = "Unknown Browser"; $browser_array = array( '/msie/i' => 'Internet Explorer', '/firefox/i' => 'Firefox', '/safari/i' => 'Safari', '/chrome/i' => 'Chrome', '/opera/i' => 'Opera', '/netscape/i' => 'Netscape', '/maxthon/i' => 'Maxthon', '/konqueror/i' => 'Konqueror', '/mobile/i' => 'Handheld Browser' ); foreach ($browser_array as $regex => $value) { if (preg_match($regex, $user_agent)) { $browser = $value; } } return $browser; } $user_os = getOS(); $user_browser = getBrowser(); $device_details = "<strong>Browser: </strong>".$user_browser."<br /><strong>Operating System: </strong>".$user_os.""; print_r($device_details); //detail //echo("<br /><br /><br />".$_SERVER['HTTP_USER_AGENT'].""); ?>Above scripts works well when I run it... It will display my OS version But the problem it is, I want to create an input field so user can key in any IP address and the scripts above will display the OS info/name if valid else invalid... Above scripts use.. $user_agent = $_SERVER['HTTP_USER_AGENT']; that automatically display OS info/name... But I want manually key in the IP from input field and the scripts above will display correspond OS info/name from the input field... how to change scripts above...especially $user_agent = $_SERVER['HTTP_USER_AGENT']; so it can return IP address from input field?? I`m greatly honor if you guys would like to help out.. I have a form that is processed using PHP (post method) and there is a textarea people will enter text into. After processing, the text is displayed to the user. However, if the user did a Carriage Return (i.e. hit Enter) when they originally entered the text, that text does NOT show on a new line when displayed later. For example, if they type this into the text area... "Hello there (they hit Enter here) How are you (they hit Enter here) Good I hope" It will display like this, all on one line: "Hello there How are you Good I hope" In other words, it doesn't seem to remember that Enter was hit. Is there some way to "preserve" the fact that someone hit the "Enter" key, so that when text is displayed later, it will show the text on a new line if the user in fact hit "Enter" when originally typing it. I am probably not using the right terms in the right spots (i.e. newline, carriage return, enter, etc) but I think you get the picture Let me know if anyone knows how to do this. Thanks! Hi, very simple i'm sure... i have a code for a text box to pull info into from a mysql table. easy enough: Code: [Select] <?php echo "<input type=\"text\" id=\"b_info\" name=\"b_info\" value=\"$b_info\" style=\"width: 327px\" /text>"; ?> but suppose i dont just want a "line of text" i want one of those boxes with the scroll bar down the side (lol like the one im writing this in ) how do i change the above code to do it? i though doing this: Code: [Select] <?php echo "<input type=\"textarea\" id=\"b_info\" name=\"b_info\" value=\"$b_info\" style=\"width: 327px\" style=\"height: 185px\" /textarea>"; ?> would work, but obviously not, all ive done is make the box bigger easy workaround? Thanks I have a textarea and a button, I would like by click a button, the text within the textarea will save as a .txt file and downloadable by user, how to do it with php?? Thanks!! Hi, So i have a form with 4 text inputs (input1,input2,input3,input4). When the user puts in 4 correct words, they are redirected to another page. The words can be checked either via a field in a database or a variable. Any wrong word in any of the text fields returns the user back to the page. In other words: When the user clicks submit, we need to make sure all of the words are correct. If they are not correct, nothing should happen. The user will remain on the page until they enter the correct words. If the words ARE correct, they are directed to a new page with an image. I am not sure how to approach this, I tried using if and case, however I am not sure of the combination to make all 4 fields checked before an out is given (ie, the page redirect). Any help is appreciated. I'm not sure how this would be done with php or something else, what I want is to have a button and when the button is pressed it creates a drop down menu and if it's pressed again then it creates a second drop down menu. I've been googling but haven't found anything yet if someone has an idea or a tutorial that they could direct me to that would be very helpful!!!! Any help is greatly appreciated, thanks in advance!!! not sure if this will find an answer but I am posting anyway. Any help is appreciated....my coder has left the team and no matter how I invite her to come and do some bug squashing, her new schedules won't fit a re-visit into my little aplication...I am eager to delve into the codes at my very low knowledge of php. I have initiated reading and is still trying to teach myself...but of course not as fast as the app needs the patch...here's the meat: I have a form that generates html code, and displays it in a textarea with submit button. I want to submit button to take the data entered in that textarea1 on page 1, and upload to textarea2 on page 2 How can I do this? I have no idea where to start. Hi, can anybody check on this code? I don't have any errors in it, except that the supposedly alert after I deleted an information is not working. Thank you very much. **This is a modified code provided by a friend. It worked originally (I just lost the original file since I sold my old computer xD Here's the code: <?php include("dbconnection.php"); if(mysql_num_rows($result) > 0) { $query = "SELECT * FROM records WHERE id = '".$_GET["id"]."'"; $result = mysql_query($query, $connection); $status = mysql_result($result, 0, "status"); $territory = mysql_result($result, 0, "territory"); $job_title = mysql_result($result, 0, "job_title"); $area_of_work = mysql_result($result, 0, "area_of_work"); $employer = mysql_result($result, 0, "employer"); $department = mysql_result($result, 0, "department"); $location = mysql_result($result, 0, "location"); $date_posted = mysql_result($result, 0, "date_posted"); $closing_date = mysql_result($result, 0, "closing_date"); $gender = mysql_result($result, 0, "gender"); $first_name = mysql_result($result, 0, "first_name"); $last_name = mysql_result($result, 0, "last_name"); $telephone_number = mysql_result($result, 0, "telephone_number"); $title = mysql_result($result, 0, "title"); $address_1 = mysql_result($result, 0, "address_1"); $address_2 = mysql_result($result, 0, "address_2"); $address_3 = mysql_result($result, 0, "address_3"); $city = mysql_result($result, 0, "city"); $country = mysql_result($result, 0, "country"); $postal_code = mysql_result($result, 0, "postal_code"); $website = mysql_result($result, 0, "website"); $email_address = mysql_result($result, 0, "email_address"); $cg_comment = mysql_result($result, 0, "cg_comment"); $date_emailed = mysql_result($result, 0, "date_emailed"); $mailing_comments= mysql_result($result, 0, "mailing_comments"); $telesales_comments= mysql_result($result, 0, "telesales_comments"); } if(isset($_POST["btnSubmit"])) { $id = $_POST["id"]; $query = "DELETE FROM records WHERE id = '".$id."'"; mysql_query($query) or die(mysql_error()); echo "<script> alert('You have successfully deleted a record'); window.location = 'view_client.php'; </script>"; } ?> Hello, I had a page that lists the tags in a php page, I had make a link looks like : tag.php?ID=2&action=delete I need to give an alert before the tag being deleted. how can I do this? Thanks This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=317425.0 im trying to get new user messages to show up on my site.. i have looked around on google but can only find info on popup alerts.. i just need a simple javscript code that will display the number of new messages next to the link that takes them to their inbox.. if someone could point me to a site or if they have the code handy i would appreciate it more than you know.. thank you So say I have a page with 3 buttons on:
<button id="1" onclick="clickFunction()">1 </button> <button id="2" onclick="clickFunction()">2</button> <button id="3" onclick="clickFunction()">3</button>How do I then create an alert displaying which was pressed? e.g: <script> function clickFunction() { alert("Button X Was Pressed"); } </script>I know in this case I could create 3 different functions but I want to use it for a page with a lot more than 3. Thanks, This is my code Code: [Select] $file = $file . $line; fclose($fh); echo "<script language= 'JavaScript'>alert(' . $file . ');</script>"; the alert box is not coming up. Please suggest a way to print the contents of the file in a alert box. Hi, In my attendance system i want to add email alert using php. I want the system to check the records in my db and send email to everyone that forgot to clock-in after 7:30AM from Sunday to Thursday. What i need to use for this, ideas? This might be more than just a php question but here goes anyways. I have designed a php chat room page on my home Apache server just for a few friends & family. The problem I have is the only way for me to know if anyone is on the chat room page is if I'm actually viewing the php page. Is there a way that I can have the page alert me when someone accesses it? I was thinking something like activating a popup in my browser or even a beep so as long as I'm at my computer with my browser open that I will know someone has accessed the page. Hello all; I need to throw up a confirmation alert before allowing a database deletion. Here's the code I wrote: Code: [Select] echo "<a href='task.php?option=delete\"onclick=\"return (confirm('Do you really want to delete this?'));>Delete</a>"; The idea is that the Javascript prevents the .php from completing unless the user Confirms. It works great as .html, but I've clearly done something wrong in the .php version, as it never invokes the alert. Does anyone have any idea where I went so horribly, horribly wrong? Thanks! Kyle Hi I have a live chat integrated into my website that uses Ajax, PHP and MySQL. When two people have the chat window open they can chat and it works fine. How can I send an alert to the person being requested to chat with, or for the chat.php page to popup automatically. It prob needs to be some function constantly running in the background check the DB for new message entries. Thanks Jay |