Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Form Problem

Featured Replies

I'm having problems with a contact form on a site (Here) it's not letting me submit details. Any help will be appreciated.

Without seeing the code for both the form itself and the php file it's hard to tell. Would you be able to paste it up on here so we can check it out?!

Thanks, Mark.

 

I'm having problems with a contact form on a site (Here) it's not letting me submit details. Any help will be appreciated.
  • Author

PHP

 

<?php

// ------------- CONFIGURABLE SECTION ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto		= "youremailaddress@example.com";

$mailto = 'enquiries@harboursidebodyshop.co.uk';

// $subject - set to the Subject line of the email, eg
//$subject	= "Feedback Form";

$subject = "Feedback Form";

// the pages to be displayed, eg
//$formurl		= "http://www.example.com/feedback.html";
//$errorurl		= "http://www.example.com/error.html";
//$thankyouurl	= "http://www.example.com/thankyou.html";

$formurl = "http://www.harboursidebodyshop.co.uk/Contact.html";
$errorurl = "http://www.harboursidebodyshop.co.uk/error.html";
$thankyouurl = "http://www.harboursidebodyshop.co.uk/thankyou.html";

$email_is_required = 0;
$name_is_required = 1;
$phone_is_required = 1;
$uself = 0;
$use_envsender = 0;
$use_utf8 = 1;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n";
$content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"';
if (!isset( $use_envsender )) { $use_envsender = 0; }
$envsender = "-f$mailto";
$name = $_POST['name'];
$phone = $_POST['phone']
$email = $_POST['email'];
$comments = $_POST['comments'];
$where = $_POST['where'];
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit;
}
if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($phone_is_required && (empty($email) || !ereg("@", $phone))) || ($name_is_required && empty($name))) {
header( "Location: $errorurl" );
exit;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit;
}
if (empty($email)) {
$email = $mailto;
}

if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}

$messageproper =
"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Phone of Sender: $phone\n" .
"Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n" .
$comments .
"------------------------- Where Did They Hear About Us -------------------------\n\n" .
$where .
"\n\n------------------------------------------------------------\n";

$headers =
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.12.0" .
$headersep . 'MIME-Version: 1.0' . $headersep . $content_type;

if ($use_envsender) {
mail($mailto, $subject, $messageproper, $headers, $envsender );
}
else {
mail($mailto, $subject, $messageproper, $headers );
}
header( "Location: $thankyouurl" );
exit;

?>

 

<td width="178"><input type="text" name="name" id="tswname" size="25" />
 <span class="style30">(required)</span></td>
</tr>
<tr><td><label for="tswphone"><span class="style26">Phone</span></label>
 <span class="style26">:</span></td>
<td><p>
 <input type="text" name="phone" id="tswphone" size="25" />
<span class="style30">(required)</span> </p>
 </td></tr>

<tr><td><label for="tswemail"><span class="style26">Email address</span></label>
 <span class="style26">:</span></td>
<td><input type="text" id="tswemail" name="email" size="25" /></td></tr>
<tr>
<td colspan="2">
<label for="tswcomments"><span class="style26">Comments:</span></label>
<span class="style30">(required)</span>
<p><br />
<textarea rows="15" cols="55" name="comments" id="tswcomments" ></textarea>
</p>

</td>
</tr>
<tr><td width="157"><label for="tswwhere"><span class="style26">Where Did You Hear About Us?</span></label>
 <span class="style26">:</span></td>
<td width="178"><input type="text" name="where" id="tswwhere" size="25" /></td></tr>
<tr>
<td align="center" colspan="2">
<input type="submit" value="Send Feedback" /><br /></td>
</tr>
</table>
</form>
 <p class="style18">Or contact us on one of the following:</p>

Hi

 

What is the form action, does it link correctly to your php file

 

Pat

 

EDIT: just had a look at your source code, rename your php file something like mymailform.php and save it to the root on your server.

Change the form action to

<form action="mymailform.php" method="post">

  • Author

Just had a look and 123-reg doesn't allow php but it allows perl so I found some perl script for a feedback form but havn't got a clue how to use perl.

Just had a look and 123-reg doesn't allow php but it allows perl so I found some perl script for a feedback form but havn't got a clue how to use perl.

try this

 

http://www.freedback.com/

 

there is no adverts etc if you only have one form you can use this untll you find out how to make your pearl script work

 

i noticed when you click the email link you get this

 

http://www.harboursidebodyshop.co.uk/enqui...ebodyshop.co.uk

 

that doesnt look right to me

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.