The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> form submit and redirect
Philbie
post Oct 30 2008, 03:18 PM
Post #1





Group: Members
Posts: 2
Joined: 30-October 08
Member No.: 7,014



Hi anyone at all please help. I created a form in dreamweaver and a sendresults.php and redirection to confirmation.htm
When I submit the form, it redirects me to the sendresults.php ! if anyone is laugh.gif at this stage you should know that
I am not a pooter person but I'm getting more respectful of them by the minute.
here is the code:

<?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 = 'mail@psyfactor.eu';

// Where to redirect after form is processed.
$url = 'http://www.psyfactor.eu/confirmation.htm';

// 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.'">';
?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Oct 30 2008, 03:26 PM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,259
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



Can you provide the URL (address) of a document that demonstrates the problem?

Without seeing the form, my guess is that the action attribute is wrong. But that's just a guess.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Philbie
post Nov 1 2008, 10:00 AM
Post #3





Group: Members
Posts: 2
Joined: 30-October 08
Member No.: 7,014



Hi yes - thanks for this
the address is
www.psyfactor.eu/contact form.htm

cheers
Phil
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Nov 1 2008, 10:15 AM
Post #4


Jocular coder
********

Group: Members
Posts: 2,298
Joined: 31-August 06
Member No.: 43



The action seems to be right, but the php document is not being passed through the php interpreter. You need to find out how your host does things - with luck you just add somethng to .htaccess.

http://www.psyfactor.eu/sendresults.php


And sending a <meta > fragment of html is a crummy way to redirect, since you could send a proper redirect header, .... but why redirect anyway? The form handler can simply output whatever confirmation you need.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th December 2017 - 07:22 PM