PDA

View Full Version : Having issues with a Form in DWMX


guerrero67
08-21-2008, 09:01 AM
Good day! new to this site!! :lol:
I have been trying to create a form. I used the tutorial in the site but I am not recvng the messages. Look at the code and let me know if someone sopts anything..
Thanks,


<?php
//--------------------------Set these paramaters--------------------------
// Subject of email sent to you.
$subject = 'Results from Contact form';
// Your email address. This is where the form information will be sent.
$emailadd = 'abeguerrero@biztechlutions.com';
// Where to redirect after form is processed.
$url = 'http://www.biztechlutions.com';
// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';
// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>

davidj
08-21-2008, 09:19 AM
this needs to be run on a live server with a php service

is this what your doing

guerrero67
08-21-2008, 04:05 PM
Yes I am. It is already up on the server. Everything seems to be working well but I am not recvng the actual email. The form is a simple contact form. I am wondering if there is something wrong with it...
Here is the code to the form.

<html>
<head>
<title>Techlutions Contact Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #999999;
}
body,td,th {
font-family: Calibri;
}
.style1 {color: #FF9933}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body>
<div id="Layer1" style="position:absolute; width:154px; height:36px; z-index:1; font-size: xx-large; left: 333px; color: #FF9900; top: 32px;">Contact Us </div>
<div id="Layer2" style="position:absolute; width:163px; height:215px; z-index:2; left: 837px; top: 9px;"><img src="j0423084.jpg" width="163" height="214"></div>
<div id="Layer3" style="position:absolute; width:693px; height:39px; z-index:3; left: 69px; top: 86px; font-size: 16px; font-style: italic; color: #FFFFFF;"> Thank you for your interest in Techlutions Business Consulting. Please provide us with your contact information for your initial consultation. We will contact you with in 24hours. </div>
<blockquote>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div id="Layer5" style="position:absolute; width:172px; height:14px; z-index:5; left: 137px; top: 167px; font-size: 12px; color: #FFFFFF;">XXXXXXXXXXXXX </div>
<p>&nbsp;</p>
<div id="Layer6" style="position:absolute; width:173px; height:15px; z-index:6; left: 137px; top: 181px; font-size: 12px; color: #FFFFFF;">XXXXXXXXXXXXXX</div>
<div id="Layer4" style="position:absolute; width:191px; height:15px; z-index:4; left: 137px; top: 149px; color: #FF9933; font-size: 12px;">Techlutions Business Consulting </div>
<form action="/sendresults.php" method="post" name="contact_form" id="contact_form">
<p class="style1">
Enter Company/Contact Name:
</p>
<p class="style1">
<input name="Company Name " type="text" id="Company Name " size="35">
</p>
<p class="style1">Email Address:</p>
<p class="style1">
<input name="Email" type="text" id="Email" size="35">
</p>
<p class="style1">Message subject: </p>
<p class="style1">
<input name="Subject" type="text" id="Subject" size="35">
</p>
<p class="style1">Enter Message here:</p>
<p class="style1">
<textarea name="textarea" cols="65" rows="15"></textarea>
<input name="Submit" type="submit" value="Submit">
<input name="Reset Form" type="reset" id="Reset Form" value="Reset Form">
</p>
<p class="style1">&nbsp; </p>
<p>&nbsp; </p>
</form>
<p>&nbsp;</p>
<div id="Layer7" style="position:absolute; width:160px; height:16px; z-index:7; left: 150px; top: 212px; color: #FFFFFF; font-size: 12px;">Office: 956-566-4111 </div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</blockquote>
</body>
</html>

domedia
08-21-2008, 09:48 PM
This page does not send the email.
sendresults.php does.

edbr
08-22-2008, 02:10 AM
you are passing values 'textarea' so is your form handler,sendresults getting that as a $_post variable?

guerrero67
08-22-2008, 04:40 AM
It should be. That is the way it is set on the properties method. It does everything it is supposed to like redirect after submitting the form, it just does not send the mail...

edbr
08-22-2008, 05:19 AM
the e mail will be sent using mail() function in side the () it may have the info to send in strings, as every thing works i would think the value isnt included.
If in doubt post the sendresults code

guerrero67
08-22-2008, 06:35 AM
<?php
//--------------------------Set these paramaters--------------------------
// Subject of email sent to you.
$subject = 'Results from Contact form';
// Your email address. This is where the form information will be sent.
$emailadd = 'myemail';
// Where to redirect after form is processed.
$url = 'http://webaddress;
// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';
// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>

edbr
08-22-2008, 07:03 AM
pass! i cant see the problem,
and sorry i did not read the post at the top properly.
I assume that you filled in sendresults, ie the e mail address as per your first post.
i wonder if it is a server setting

davidj
08-22-2008, 07:04 AM
where you have


$url = 'http://webaddress;


you have missed a closing quote

edbr
08-22-2008, 07:08 AM
and David,do you have the address of the opticians for me,Mr Seymor Clearly?

davidj
08-22-2008, 07:21 AM
its my ninja training

guerrero67
08-22-2008, 07:24 AM
I have the end mark on the original code... I thought everything was ok with it also. I am using GoDaddy to host this site. I am not sure if the problem lies there or on DreamweaverMX...

edbr
08-22-2008, 07:29 AM
dont see how it can be dreamweaver,

davidj
08-22-2008, 09:09 AM
create a page (blank)

add the mail function below and replace the text within to suit your needs. e.g replace the email with your own.



<?php

mail('yourmailhere@home.com', 'My Subject', 'this is a test mail');

echo "the page has run";

?>


upload to your server and then browse for the mail page.

this will send a mail to you so you will be able to find out if its the server is at fault

guerrero67
08-22-2008, 04:25 PM
The page was sent but I got no email. I tried 2 different email accounts and no dice! Ok well it must be the server. Like I said I am using a godaddy server for this particular site.. any suggestions??

davidj
08-22-2008, 05:24 PM
and you have php services?

ask your host if they have mail restrictions

guerrero67
08-22-2008, 06:21 PM
I am kinda new at PHP. What service are you talking about? via the domain server??

Corrosive
08-22-2008, 06:37 PM
I am kinda new at PHP. What service are you talking about? via the domain server??

Yes, your web hosts will tell you if you have PHP capabilities on your webspace. Always good to check this before you buy.

domedia
08-22-2008, 07:03 PM
*cough* and if you go to our homepage, you'll see 2 great webhosts in the left hand column ;-)

guerrero67
08-22-2008, 07:17 PM
I was running the website on a windows server... (don't know why) but I called the hosting company and had them migrate the files to a Linux based server.

Thank everyone for thier support and posts!! This forum is the shit!

Never again will I doubt DWMX!!:grin:
Hope this works. will keep u posted..

davidj
08-22-2008, 07:21 PM
*cough* and if you go to our homepage, you'll see 2 great webhosts in the left hand column ;-)

SPAM SPAM SPAM SPAM
SPAM SPAM SPAM SPAM
SPAM SPAM SPAM SPAM
SPAM SPAM SPAM SPAM
SPAM SPAM SPAM SPAM
SPAM SPAM SPAM SPAM
SPAM SPAM SPAM SPAM