View Full Version : Help with forms

06-15-2004, 09:54 PM
Need help with posting form data from my site. I would like to recieve input from this form posted directly. This is the code as it exists today, set up to mail to me.

<form action="mailto:info@winwithedwin.com" method="GET" enctype="multipart/form-data">
<input type="text" onBlur="if(this.value=='') this.value='Full Name...';" onFocus="if(this.value=='Full Name...') this.value='';" value="Full Name..." name="from" size="20">
<input type="text" onBlur="if(this.value=='') this.value='Phone Number...';" onFocus="if(this.value=='Phone Number...') this.value='';" value="Phone Number..." name="Phone" size="20">
<input type="text" onBlur="if(this.value=='') this.value='Email Address...';" onFocus="if(this.value=='Email Address...') this.value='';" value="Email Address..." name="email" size="20">
<textarea name="bodytext" cols="22" rows="3" id="textarea">Comments...</textarea>
<input type="submit" value="Submit" name="Submit">
<input type="reset" value="Reset" name="Submit2">

My ISP has a set of simple templates that allow me to create a CGI form page, such as this:

<tr><td width="14%"><b>Name:</b></td><td width="35%"><input type="text" name="name" size="30" style="width: 100%" value=""></td><td width="2%"> </td><td width="14%"><b>E-mail:</b></td><td width="35%"><input type="text" name="email" size="30" style="width: 100%" value="@"></td></tr><tr><td><b>Subject:</b></td><td colspan="4"><input type="text" name="subject" size="60" style="width: 100%" value=""></td></tr><tr><td valign="top"><b>Comments:</b></td><td colspan="4"><textarea cols="60" width="100%" rows="10" name="body" style="width: 100%"></textarea></td></tr><tr><td> </td><td colspan="4"><input class="button" type="submit" value="Save entry"></td></tr></table></td></tr><input type="hidden" name="no" value="-1"><input type="hidden" name="entrykey" value="-1"><input type="hidden" name="key" value="HKr05u1c"><input type="hidden" name="adminkey" value=""><tr><td><table width="100%" cellspacing="0" class="invert"><tr><td class="invert" width="20%"> </td><td class="invert" align="center" width="60%"><a class="invert" href="http://misellbyowner.com:80/tinc?key=i525D8U4&amp;amp;start=-1&amp;amp;epp=5&amp;amp;reverse=1">Regular View</a> | <a class="invert" href="http://www.winwithedwin.com">Home</a></td><td class="invert" align="right" width="20%"> </td></tr></table></td></tr></table></form></center></body></html>

The template created form page is here: http://misellbyowner.com/tinc?key=pNWUPNEz&amp;no=-1&amp;entrykey=-1&amp;reverse=1

My site (with the input for a form) is here www.winwithedwin.com

Any help on how to post the fields from my website to the form for me to manage?

Or how to create and edit forms?

06-16-2004, 09:52 AM
Hi edd

I have not tested this yet but should work

change this
<form action="mail.php" method="post" enctype="multipart/form-data">

Add these files to the site.




$error="The following errors occured while processing your form input.<ul>";

if($from=="" || $email=="" ){
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)){
$error.="<li>Invalid email address entered";
if($errors==1) echo $error;

$message="name: ".$from."

Name: ".$from."
Email Address: ".$email."
Comments : ".$bodytext."
$bodytext = stripslashes($bodytext);

mail("info@winwithedwin.com","Form Submitted at your website",$message,"From:info@winwithedwin.com");

header("Refresh: 0;url=index.php");




this is the



function pt_register()
$num_args = func_num_args();
$vars = array();

if ($num_args >= 2) {
$method = strtoupper(func_get_arg(0));

if (($method != 'SESSION') &amp;&amp; ($method != 'GET') &amp;&amp; ($method != 'POST') &amp;&amp; ($method != 'SERVER') &amp;&amp; ($method != 'COOKIE') &amp;&amp; ($method != 'ENV')) {
die('The first argument of pt_register must be one of the following: GET, POST, SESSION, SERVER, COOKIE, or ENV');

$varname = "HTTP_{$method}_VARS";
global ${$varname};

for ($i = 1; $i < $num_args; $i++) {
$parameter = func_get_arg($i);

if (isset(${$varname}[$parameter])) {
global $$parameter;
$$parameter = ${$varname}[$parameter];


} else {
die('You must specify at least two arguments');




06-29-2004, 03:21 PM
I've added it, buit now I get a blank page when I submit. It should be at the root directory? (The same level where index.php is? Or stored under the template subdirectory?

06-29-2004, 03:25 PM
It's sending me the email directly, but it leaves the user on the blank mail.php page, rather than leaving them at the index.php page. Anybody have hints on how to redirect them to homepage?

Fat Lizard
06-30-2004, 02:10 AM
print "<script> function redirect() { window.location.replace('$files[core_login]'); } setTimeout('redirect();', 2000); </script>";

06-30-2004, 09:18 AM
I wasn't able to get the print <script> to work, but I was able to add a tag like this after the <?php>

<META HTTP-EQUIV="Refresh" CONTENT="2;URL=http://www.yoursite.com/index.php">

It seems to work OK, does the refresh rate have to be set in integer values?

Fat Lizard
06-30-2004, 12:06 PM
Your refresh rate is an integer.

As for my previous post .. Ooops, I just cut 'n pasted from a file .. You'd use something like :

print "<script> function redirect() { window.location.replace('index.php'); } setTimeout('redirect();', 2000); </script>";

This is assuming that the file you want to redirect to is in the same directory, and, 2000 ~= 2 secs.