Jump to content

Feedback Form, GET function not grabbing info from URL.


jessica_m88

Recommended Posts

Hello. Basically the issue I am having is my feedback form is not grabbing the Company Name and ID from the URL. I have the php code set in place where it's supposed to post, but it's not getting it. Can someone please help me out? I'm pretty new with php, so I'm kind of at the brink of my knowledge.

 

Thanks, Jess. 

 

<?php
//Modified because only email is required
//if (empty($_POST['name']) || empty($_POST['email']) || empty($_POST['comments'])) {
if (empty($_POST['email'])) {
	$error_msg .= "E-mail is a required field. \n";
} elseif (strlen($_POST['name']) > 15) {
	$error_msg .= "The name field is limited at 15 characters. Your first name or nickname will do! \n";
} elseif (!ereg("^[A-Za-z' -]*$", $_POST['name'])) {
	$error_msg .= "The name field must not contain special characters. \n";
} elseif (!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$",strtolower($_POST['email']))) {
	$error_msg .= "That is not a valid e-mail address. \n";
} elseif (!empty($_POST['url']) && !preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(\d+))?\/?/i', $_POST['url']))
	$error_msg .= "Invalid website url.";

if ($error_msg == NULL && $points <= $maxPoints) {
	$subject = "Feedback for " . $_POST['Company'];

	$message = "You received this e-mail message through your website: \n\n";
	foreach ($_POST as $key => $val) {
		$message .= ucwords($key) . ": $val \r\n";
	}
	$message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n";
	$message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\r\n";
	$message .= 'Spam points: '.$points;

	if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) {
		$headers   = "From: $yourEmail \r\n";
		$headers  .= "Reply-To: {$_POST['email']}";
	} else {
		$headers   = "From: $yourWebsite <$yourEmail> \r\n";
		$headers  .= "Reply-To: {$_POST['email']}";
	}

	if (mail($yourEmail,$subject,$message,$headers)) {
		echo '<p>Thank you for taking the time to send us your feedback. Your comments are appreciated and help us provide the most current and accurate information possible.</p> 
<p>If you require further assistance, please visit our <a href="http://www.domain.com/" target="_blank">contact us</a> page.</p>';
		$sentmail = 1;

		echo '
		<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("analyticscode"); 
pageTracker._setDomainName(".domain.com");
pageTracker._trackPageview();
</script>
		';

	} else {
		echo '<p>Your mail could not be sent this time.</p>';
	}
}
}
function get_data($var) {
if (isset($_POST[$var]))
	echo htmlspecialchars($_POST[$var]);
}

?>




<?php
foreach( $_POST as $checkbox ){
echo $checkbox .'<br />';
$checkbox = array("WebsiteLinkIsNotAccurate", "TelephoneNumberIsNotAccurate", "FaxNumberIsNotAccurate", "CompanyIsOutOfBusiness", "CompanyIsNoLongerAtThisLocation", "CompanyDoesNotProvideTheProductOrServiceAsFeatured", "Other(PleaseExplainBelow)");
}
?>




<?php
// DISPLAY ERROR MESSAGE - CHECK TO SEE IF USER HAS SUBMITTED THE FORM SUCCESSFULLY
if ($error_msg != NULL) {
echo '<p><strong style="color: red;">ERROR:</strong><br />';
echo nl2br($error_msg) . "</p>";
}

if($sentmail == 0){
?>

<form id="feedback" name="feedback" method="post" action="feedback.php" onSubmit="return CheckForm()">
<noscript>
	<p><input type="hidden" name="nojs" id="nojs" /></p>
</noscript>

<input type="hidden" name="CompanyID" id="CompanyID" value="<?php echo $_POST['companyid']; ?>">
<input type="hidden" name="Company" id="Company" value="<?php echo $_POST['companyname']; ?>">


<p><strong>If you have different information about <u><?php echo $_POST['companyname']; ?></u>, or were unable to contact them, please let us know by completing the form below.</strong></p>
...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.