• Best of luck to the class of 2024 for their HSC exams. You got this!
    Let us know your thoughts on the HSC exams here
  • YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page
MedVision ad

HTML query! (1 Viewer)

Joined
Mar 15, 2008
Messages
202
Gender
Male
HSC
N/A
hey guys, im new to HTML and was wondering how you would be able to create code or use code that is like user feedback capable. For instance, like this <FORM METHOD=post ACTION="/cgi-bin/example.cgi">
Enter Your Comments:<BR>
<TEXTAREA wrap="virtual" name="Comments" rows=3 cols=20 MAXLENGTH=100></TEXTAREA><BR>
<INPUT type="Submit" VALUE="Submit">
<INPUT type="Reset" VALUE="Clear">
</FORM>

when you paste it, it becomes a submission thing for the user. But, how do you create a link to it which enables you to get the results of user feedback?









Thanks in advance,
lookoutastroboy
 

zvyx

Member
Joined
Aug 10, 2006
Messages
95
Location
NSW
Gender
Male
HSC
2008
I learnt my HTML via this site, which is pretty great. This is the forms section:
HTML Forms and Input

But I don't get what you mean. I'm guessing the input goes to that cgi file, which does something to that data. Perhaps you need to learn a web scripting language as well for the cgi file?
The other option is to send an email to you; I've done that before and it works fine. Link:
Tryit Editor v1.4

So that'll give you the result of whatever they entered, straight to your mailbox.
 

tehpyro

Lord of Bored
Joined
Aug 1, 2006
Messages
201
Location
North Shore, Sydney
Gender
Male
HSC
2007
hey guys, im new to HTML and was wondering how you would be able to create code or use code that is like user feedback capable.
This usually requires some form of service that can process information (ASP code works particularly well). HTML will not handle the processing of user input. However, if you're new to HTML, it probably means you're new to most of these coding languages, which could be problematic.

As zvyx said, email could be a legitimate option, but I would suggest setting up an email address just for this purpose.
 

Patato

New Member
Joined
Nov 5, 2009
Messages
27
Gender
Male
HSC
2011
Hey,

HTML is a markup language, so it alone can't handle information processing, however server side languages like PHP and ASP will.

If you have access to a server running PHP, if you don't you can download a free WAMP Server (Windows Apache Mysql & PHP) and install that.

Here is how you'd do it in PHP based on that form; note you'd need to change the action attribute in the form tag to point to the PHP script holding the code below.

Also assign a value for the name attribute on the submit tag.

Code:
<?PHP

if (isset($_POST['Submit'])) { // Check to see if a comment has actually been submitted
[INDENT]$comment = $_POST['Comment']; // Retrieve the comment from the 'post' superglobal variable

/*
Do something with the comment here. Remember to protect against MySQL injections if you are inserting it into a MySQL database.
 */

// For examples sake, the following code would e-mail you the comment

mail("your-email-address@isp.com", "A new comment!", $comment);

/* 
The first argument is the address you wish to send to, the second is the subject, and third is the body of the e-mail. You won't be able to send e-mail with WAMP unless you also install and run an SMTP server.
 */
[/INDENT]
}
?>
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top