Click to See Complete Forum and Search --> : Forms


Goliath123_4
04-09-2005, 06:55 PM
is there a way i can let people submit a form without using their outlook express?

HaganeNoKokoro
04-09-2005, 06:57 PM
You will need server-side code for this (PHP, ASP, ASP.NET, Java/JSP, Perl)

Goliath123_4
04-09-2005, 06:58 PM
oh, is that what i need, any idea where i can find one?

HaganeNoKokoro
04-09-2005, 07:03 PM
Firstly, what languages does your server support?

Goliath123_4
04-09-2005, 07:11 PM
Asp, Php, Perl....

HaganeNoKokoro
04-09-2005, 07:43 PM
Well, in ASP you would use the Request.Form (for method="post") or Request.QueryString (for method="get") to get the values of the form inputs by name. Then you could write them to a text file, stick them in a database, and/or email them. The way I usually do this is something like<%@ Language="JScript" %>
<%
var formvalue=Request.Form("inputname");

var objMail=Server.CreateObject("CDONTS.NewMail");
objMail.To="address@example.com";
objMail.From="otherAddress@example.com";
objMail.Body=formvalue;
objMail.Subject="Example Subject";

objMail.Send();
%>

webgovernor
04-09-2005, 09:34 PM
here's the PHP (I like it much better then ASP, just my opinion)

form.php code
<?php
$to = $_POST['to'];
$from = "From: " . $_POST['from'];
$question = $_POST['question'];
$subject = $_POST['subject'];

mail($to, $subject, $question, $from);
?>

And here's the HTML

<form action="form.php" method="post">
TO: <input type="text" name="to" /><br />
FROM: <input type="text" name="from" /><br />
SUBJECT: <input type="text' name="subject" /><br />
QUESTION: <br />
<textarea name="question" cols="55" rows="15">
Enter question here
</textarea>
<br />
<input type="submit" name="submit" value="Send Question" />
</form>

Goliath123_4
04-11-2005, 12:21 AM
so what exactly do i do with those?

ne3ro0
04-11-2005, 02:04 AM
i have that kind of problem? i already uploaded the script that i have, it was a PHP. but i dont recieve the mail that i used to send in the email address i specified in my script. what cause this problem? can you help me doing so?

heres the PHP code: contact.php
<?php
global $name;
if($name) {
$name=$_GET['name'];
$email=$_GET['email'];
$subject1=$_GET['subject'];
$message=$_GET['message'];
$ip=$_SERVER["REMOTE_ADDR"];
$host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$host = $ip.".".$host;
$mon=date(m);
$day=date(j);
$year=date(y);
$hour=date(g);
$min=date(i);
$sec=date(s);
$hour=$hour-2;
if($hour<=0) { $hour+=12; }
$ts = "$hour:$min:$sec on $mon/$day/$year";
$to="exalta_256mb@yahoo.com";
$subject="Contact Form:"." $subject1";
$body="
Message from: $name
Subject: $subject1
E-mail: $email
Message: $message

Host: $host
Time: $ts";

mail($to, $subject, $body);
echo "<script>location.href=\"http://mysite.com/thanks.php\"</script>";
}
?>

and heres my HTML code: contact.php
<html>
<head>
<title>Contact Us</title>
</head>

<body bgcolor="#ffffff" text="#666666">
<font face="verdana" size="1">
<form method="post" action="contact.php">
Your Name:<br>
<input type="text" name="name" style="border: 1px solid #cccccc; background-color: #ffffff;"><br><br>
Your E-mail Address:<br>
<input type="text" name="email" style="border: 1px solid #cccccc; background-color: #ffffff;"><br><br>
Subject:<br>
<input type="text" name="subject" style="border: 1px solid #cccccc; background-color: #ffffff;"><br><br>
Message:<br>
<textarea name="message" cols="40" rows="10" style="border: 1px solid #cccccc; background-color: #ffffff;"></textarea>
<br><br>
<input type="submit" value="send" style="border: 1px solid #cccccc; background-color: #ffffff;">
</form>
</font>

</body>
</html>

i used this because this was the one that easy to understand and the flow are simple. i have different code that i use to upload in the server but it was all the same, it didnt send an email to the email i specified. and the codes are just the same, some other codes needs referers and i dont know what does suppose to do. is there a problem with the PHP server which my site is hosted?

thanks in advance..

the tree
04-11-2005, 02:37 AM
ne3roo you're using GET variables in your php but your form is using the POST method, just change instances of GET to POST in your php.

Goliath put the php script into a file named form.php and the HTML in whatever file you like, in the same directory.

Goliath123_4
04-11-2005, 03:48 AM
Tree I just dont understand good man..

ne3ro0
04-11-2005, 04:10 AM
Goliath
Try to read and study HTML tags first if you dont have a background creating websites.
Or if you have, try doin this, open a NOTEPAD.EXE in your windows, or rather use your HTML editor like MS Frontpage or Macromedia Dreamweaver or any Third party software that fits your knowledge in doing so. i prefer NOTEPAD for beginners.

Copy the Codes and paste it in the notepad and save it "FORM.php" into your local Directory which resides you website, then upload it in you website server. then try to test the code.

Tree thanks for the immediate reply, i see the errors now, its some kind of complicated. so im gonna change the _GET in the php script to _POST right? then how about this tree lines:
$ip=$_SERVER["REMOTE_ADDR"];
$host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$host = $ip.".".$host;

Webgovernor
I tried to copy and upload the code you posted and test it in the server which my website resides, still i dont recieve the email i specified in the TO input field, i know that theres no problem with the code. possible reasons was the server instead? but the server supports PHP/mySQL. is there a problem with it?

Goliath123_4
04-11-2005, 04:28 PM
Yeah im familiar with notepad. I uploaded the code but i dont know how to test it, i have a separate form.html and a form.php

Goliath123_4
04-11-2005, 04:35 PM
Ive never used PHP, where do i put my email (Where I want the form to be sent) do i integrate it into my html form or make a completely new php form??

Need Answers,

ne3ro0
04-11-2005, 08:08 PM
Goliath
better visit this site first... php.net, read the PHP tutorials which posted in the site. you will learn scripting and basic PHP here. Your questions provide an answer here. Good Luck...

blockislandchic
04-12-2005, 10:18 AM
none of them work for me!!!!

goku112
04-13-2005, 12:40 PM
hmm i tried the script out, but it doesnt seem to work for me, try it out yourselves:
http://free.hostultra.com/~dfn/main.php?dbfn=affiliation.htm

i havent changed anything, except the "GET" variables into "POST"

Goliath123_4
04-16-2005, 02:53 PM
Goliath
better visit this site first... php.net, read the PHP tutorials which posted in the site. you will learn scripting and basic PHP here. Your questions provide an answer here. Good Luck...

So you're saying I can't use an HTML form that submits information to my e-mail without using the users outlook express?

ray326
04-16-2005, 03:10 PM
So you're saying I can't use an HTML form that submits information to my e-mail without using the users outlook express?
Not from the user's browser. That has to be done on the server.

Goliath123_4
04-17-2005, 04:31 PM
Not from the user's browser. That has to be done on the server.


What has to be done on the server?

ray326
04-17-2005, 06:36 PM
What has to be done on the server?
What you asked. What I quoted.

Goliath123_4
04-17-2005, 06:54 PM
What you asked. What I quoted.

The information needs to be submitted?? :o

ray326
04-17-2005, 11:30 PM
The form has to be posted to a form processor on the server that will format an email message based on the values in the form data fields. It will then send that message using whatever email connectivity is on the server, generally mail or sendmail. Anything done on the user's end must make use of the email client the user has installed.

Goliath123_4
04-19-2005, 06:59 PM
The form has to be posted to a form processor on the server that will format an email message based on the values in the form data fields. It will then send that message using whatever email connectivity is on the server, generally mail or sendmail. Anything done on the user's end must make use of the email client the user has installed.

Excellent. Now can I do this? Is this possible? :eek:

ray326
04-19-2005, 07:31 PM
Sure it's possible but how depends on what languages are available on your host system. There are also some generic "formmail" services you can use. I assume they have a small fee.

Goliath123_4
04-19-2005, 08:12 PM
Alright, so ASP, Perl and PHP are available on my server, My form and site however, are completely HTML. :eek:

ray326
04-19-2005, 11:45 PM
So I think you'll find some good examples at php.net.

master_of_web
04-20-2005, 09:07 AM
there are some javascript forms at htmlgoodies.com

Goliath123_4
04-26-2005, 04:32 PM
So I can throw a PHP form on my HTML site? eh :cool:

ne3ro0
04-26-2005, 07:41 PM
check this thread (http://www.webdeveloper.com/forum/showthread.php?t=62316)... you can view samples here...