Need a PHP script to carry a parameter/ID through to a contact form

I’m hoping this is an easy one for anyone knowledgable with PHP.

I just need a simple script that will allow a user to click on a ‘contact us for more info on this special offer’ type link, pick up a parameter on a page to identify what that special offer is (a title tag maybe?) and carry that through to the contact form so that the user doesn’t have to enter any info other than their own details etc.

If anyone can point me in the right direction I’d appreciate it, thanks!

Rich

Well, it would depend on how you generate your page? (or is this an email?)

Hey, it’s a page on a Joomla site. A regular HTML form using PHP, the script is ‘simple script’



<?php

// Simple Form Script
// Copyright (C) 2005  Eric Zhang
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// Please send bugs/questions to erkzh@yahoo.com.

//--------------------------Set these paramaters--------------------------


$subject = 'Contact from xxxxxxxxxx website';                // Subject of email sent to you.
$emailadd = 'xxxxxxxxxxx';        // Your email address. This is where the form information will be sent.
$url = 'xxxxxxxxxxxxxx';               // Where to redirect after form is processed.
$req = '1';                                  // 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.

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\
\
";       
$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('\
', "$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.'">';
?>


I’m happy to use something else if required.

mkay… so that page looks to be waiting for form input. So your link would have to pass it information.


<form id='emailme' action='whateverthatpageyoulinkediscalled.php' method='post'>
<input type='hidden' name='specialoffer' value='phpfillinblankhereblank'>
<a href="#" onclick="document.getElementById('emailme').submit();">Click here to send us an email</a>

something like that.