I am making a help file (.chm) for a project I am working on, but am having trouble with an HTML form element. What I want the form to be able to do is send an email so users can contact me about bugs, quetions, etc, but when I try the 'Submit' button, it notifies me that I am about to send the email, then crashes the Microsoft HTML Help Executable.
Here is my code:
<!DOCTYPE html>
<HTML>
<TITLE> Contact me </TITLE>
<BODY>
<IMG SRC="banner.png" WIDTH="800" HEIGHT="160" ALIGN="RIGHT" ALT="Banner">
<HR WIDTH="600" HEIGHT="5" ALIGN="RIGHT">
<P>
<H2 ALIGN="CENTER"><FONT FACE="Trebuchet MS">Contact me</FONT></H2>
</P>
<P><H4><FONT FACE="Trebuchet MS">Please enter the following details</FONT></H4>
<FONT FACE="Trebuchet MS">
<FORM ENCTYPE="text/plain" METHOD="POST" ACTION="mailto:someone#example.com">
Your name: <INPUT TYPE="TEXT" NAME="Name">
<P>Details:
<TEXTAREA ROWS="10" COLS="50" NAME="Details"></TEXTAREA>
</P>
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
</FONT>
</BODY>
</HTML>
Sorry about my terrible formatting, but hopefully you get the idea.
I have found that when I launch this in Google Chrome as a regular HTML document, it works fine and sends the email perfectly, but when I try it in Internet Explorer as an HTML, it crashes (typical). What am I doing wrong?
Thanks in advance
I don't think it's actually 100% possible, nor would I recommend it if it were.
I think a much better way would be to provide a link to a Contact Me page on your site, or simply provide your email in the body of the CHM.
General Points
UPPERCASING HTML tag names, while valid, is really annoying (subjective). A proper naming convention is where all HTML tags, attributes and keywords are lowercased.
Use <label> elements when referring to form labels, example:
<label>Your Name: <input type="text" name="Name"></label>
This adds the nice bonus of making the "Your Name:" text clickable as well!
Related
I have asked a similar question in the past but would like to know if it's possible to link the "textarea" content between the pages as I have thought that this might be a better solution.
I'm new to coding and unfortunately I don't have a good understanding of how to do it on my own.
Any help would be appreciated. I'm not sure if it's even possible.
Page 1
$linked text =
This is the text which
Should be displayed on the second page.
And should be updated automatically
Once I update this text on page 1.
Page 2
<div class="textniz">
<textarea class="two" id="myInput" name="myInput" readonly>
$linked text</textarea>
</div>
It would be nice to know more about your webserver. Sticking to the KISS principle, and using a PHP server as an example, this could be accomplished with POST and an html form like the following:
page1:
<form action="/page2.php" id="usrform">
<input type="submit">
</form>
<textarea name="comment" form="usrform">Enter linked text here...</textarea>
Then with page2.php:
<html>
<body>
<div class="textniz">
<textarea class="two" id="myInput" name="myInput" readonly>
<?php echo $_POST["comment"]; ?><!--This is where page 1 data is retrieved-->
</textarea>
</div>
</body>
</html>
The above will only update page 2 when the user clicks the submit button. For the automatic aspect you could use AJAX JS to send the updated data on each key change. You can take a look at this simple example.
I used PHP for illustrative purposes. The concept you want to implement is really about submitting and retrieving a POST request containing the linked text and is supported by all webserver types. JavaScript will help you accomplish the automatic part.
Happy New Year.
I need some help with basic HTML form with an mailto action.
I have this basic HTML code:
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta charset="utf-8">
<title>Contact</title>
</head>
<body>
<h1>My contact information:</h1>
email<br>
Phone
<br>
<hr>
<h3>Send Me a Message:</h3>
<form class="" action="mailto:XXX#gmail.com" method="post" enctype="text/plain">
<label for="Name">Your Name:</label>
<input type="text" name="Name" value=""><br>
<label for="email">Your Email</label>
<input type="email" name="email" value=""><br>
<label for="Message">Your Message:</label><br>
<textarea name="Message" rows="10" cols="30"></textarea><br>
<input type="submit" name="Save">
<hr>
Home
</body>
</html>
When someone clicks on the submit button a new email is opened with the form data.
The problem is that if the submitter use Hebrew character I get some gibberish text instead (tested with gmail as the submitter email client):
This is what the submitter see in the new email popup while clicking on submit and using Hebrew characters:
The text circled with red line is the Hebrew text submitted via the form.
I tried adding a charset="utf-8" and also accept-charset="utf-8" to the form - but still the same.
I searched google and also in here but didn't find a solution.
Can you please help a newbie?
Regards,
Ram
There are a few Stack Overflow threads that summarise and complement the issue:
Gmail API not respecting UTF encoding in subject
mailto special characters
Printing Hebrew UTF-8 produces giberish
Basically, there isn't anything you can do in HTML to fix this. You would have to replace the way the HTML is being processed, not the code itself. The way you're doing it, it will use whatever client is the user's default, so it's out of your hands.
If you choose to process it however, I suggest a sub-link within that first link:
https://ncona.com/2011/06/using-utf-8-characters-on-an-e-mail-subject/
I wrote this HTML form and I'm trying to process it in asp using POST, so that as soon as I submit the form, it should show the data that I submitted in the HTML form.
The HTML form works fine, but whenever I click on submit, It doesn't show what I've submitted, it just shows the ASP code that I wrote. I don't know what I'm doing wrong. anyone got an idea?
This is my HTML code
<!DOCTYPE html>
<html>
<head>
<title>HTML Forms!</title>
<link href="buy.css" type="text/css" rel="stylesheet" />
</head>
<body>
<h2>Give Us Your Money</h2>
<form method="post" action="validate-ex2.asp">
First Name: <input type="text" name="fname"><br><br>
Card Number: <input type="text" name="cnumber"><br><br>
<legend>Credit cards:</legend>
<input type="radio" name="cc" value="visa" checked="checked" /> Visa
<input type="radio" name="cc" value="mastercard" /> MasterCard
<br><br>
<input type="submit" value="Submit"> <br>
</form>
</body>
</html>
And this is my ASP code
<html>
<body>
<%
dim fname
fname=Request.Form("fname")
Response.Write("First Name: " & fname & "<br>")
%>
</body>
</html>
I tried everything here, here and here but still same error, I hope I haven't messed up anything by doing what was described there
EDIT: Here's an image of the output while trying to run a simple HTML code that includes ASP-classic Trying to run ASP
Apparently I had to move my ASP and HTML file to the C:\inetpub\wwwroot\ folder, but not only this. I tried running them from there as well, but still it would show the raw code. what I did first, was enabling other Windows Features (that I saw somewhere online).
This actually could've been the fix from the beginning but running the html or the asp code directly from the C:\inetpub\wwwroot\ shows the raw ASP code, I just had to type localhost/[filename].html or whatever in the browser and also modifying the permissions by adding Everyone and allowing full control and modify to the folder inside inetpub or the files themselves...
Sorry if you guys thought I was doing that from the beginning, but now it works just fine. Thanks for your help!
I am trying to make one website for my school and i just started from basic to test
security of our website and it was observed that while getting this output from there
code if we put Name: ../ and Information : (any html code) then it changes that page
into that html code which was injected. Is there any solution how i can prevent this
problem so that i have much higher security.HTML code is
<html>
<head>
<title>Submit your form</title>
</head>
<body bgcolor="Black" text="#FFFFFF" link="#FFF833" vlink="#FFF833">
<center><table width=600 cellspacing=0 cellpadding=0 align="center"><tr><td>
<font face="verdana" size=2><b>Use this form to submit your information to the website.<br /><Br>Note:Information will be stored online immediately but will not be listed on the main page until it has a chance to be looked at.<br /><br />
<form action="submit.php" method="post">Name:<br />
<input type="text" name="name">
<br /><br />Information<br /><textarea rows=15 cols=40 name="text"></textarea>
<br /><br /><input type="submit" value="add text"></form></font>
</b></td></tr></table>
</center>
</body>
</html>
As I have stated twice, it depends entirely on how you're saving this user input... wait, that's three times now XD
I'm going to guess your code is:
file_put_contents("submissions/".$_POST['name']."/index.html", $_POST['text']);
But if $_POST['name'] is ../ then you are saving their submission to submissions/..//index.html... in other words you are overwriting the homepage of the site! And by allowing $_POST['text'] to be dumped in there with no safety just lets anyone do what they want.
Instead, you should be saving these submissions to a database, referencing them by an ID number, and using something like htmlspecialchars to prevent input HTML from being processed.
you need to add some filters with your each field for the input because if you are not doing this then the chances of XSS (corss-site scripting) increases so whether you are taking input from user for suppose usernamd , password , email-ids etc always check is fields must cot contain html tag specially the JAVA SCRIPT tag. If you allowed JAVA script tag with the input it will case session hijacking so please check all thing before lunch on final domain and host . GOOD LUCK
Ok so here's my issue with trying to install the reCaptcha. On my basic HTML page I have the following form in the body of the content.
<form action="/cgi-bin/new_forms/form.pl" method="post" name="pledgeform" onSubmit="return validate(this)">
This is where all the form info is
<p><input type="submit" value="Submit"> <input type="reset" value="Clear Form"></p>
</form>
Now I know that I need to place this Google code just above my submit button:
<script type="text/javascript"
src="http://www.google.com/recaptcha/api/challenge?k=your_public_key">
</script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=your_public_key"
height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea>
<input type="hidden" name="recaptcha_response_field"
value="manual_challenge">
</noscript>
My issue is where do I go from here? I know that it needs to verify the reCaptcha but I currently have the form going to a Perl script so I'm confused. Can I have it so that the reCaptcha needs to be correct first in order for the action to go and run the Perl script? I'm not sure if I'm asking this correctly so if anyone needs any other info let me know. I'm stumped and any help would be awesome.
My skill level is basic-intermediate just so you know where I'm coming from
Captcha::reCAPTCHA has documentation on its use.
There is also an example CGI script included in the package.
Basically, yes, you need to stay on the form in order to error check that the captcha was actually filled in correctly, just like with all form error checking.