View Single Post
Old 01-03-2018, 03:25 AM   #1
vinnyvangogh
 
Join Date: Aug 2009
Posts: 88
Default Online forms & PHP send scripts

I have separated this from my previous post. I am curious to find out why this form and PHP script stopped working. Seeming after Fast2Host got hacked and the seemed to have farmed out their clients to another hosting company - it s was OK till that DNS shift

For obvious reasons - "XXXXXXX" replaces my info!

Could somebody do an online test to check it out.
I set PHP to v5.4.0 ( certiainly started with "5" and the only v5)


#<form action="http://www.xxxxxxxxxxxxx.co.uk/sendresults.php" method="post">
<td width="116" align="right">Name</td>
<td colspan="3"><font color="#400000">
<INPUT TYPE="text" NAME="name" SIZE=30>
</font></td>
<td width="50">&nbsp;</td>
<tr>
<td align="right">Position</td>
<td colspan="3"><font color="#400000">
<INPUT TYPE="text" NAME="position" SIZE=30>
</font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">Company</td>
<td colspan="3"><span class="style93">
<INPUT TYPE="text" NAME="company" SIZE=30>
</span></td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">Telephone</td>
<td colspan="3"><span class="style93">
<INPUT TPYE="text" NAME="telephone" SIZE=30>
</span></td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">Email</td>
<td colspan="3"><font color="#400000">
<INPUT TYPE="text" NAME="email" SIZE=30>
</font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">Website </td>
<td colspan="3"><font color="#400000">
<INPUT TYPE="text" NAME="website" SIZE=30>
</font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">Postal Address</td>
<td colspan="3"><span class="style93">
<TEXTAREA NAME="Postal Address" ROWS=5 COLS=30></TEXTAREA>
</span></td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">Enquiry</td>
<td colspan="3"><span class="style93">
<TEXTAREA NAME="Enquiry details" ROWS=5 COLS=30>
</TEXTAREA>
</span></td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">How Did You Find Me?</td>
<td colspan="3"><TEXTAREA NAME="How Did You Find Us" ROWS=2 COLS=30></TEXTAREA></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2"><input type="submit" value="Submit" name="submit"></td>
<td width="399"><input type="reset" name="reset"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
</tr>

</form>












<?php
//--------------------------Set these parameters--------------------------

// Subject of email sent to you.
$subject = 'Results from Contact form';

// Your email address. This is where the form information will be sent.
$emailadd = 'XXXXXXXX@hotmail.com';

// Where to redirect after form is processed.
$url = 'http://www.XXXXXXXXXXXX.com/confirmation.html';

// 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.'">';
?>
vinnyvangogh is offline   Reply With Quote