# Clear form in flash with php

**URL:** <https://forum.kirupa.com/t/clear-form-in-flash-with-php/222367>\
**Category:** Uncategorized\
**Created:** [April 12, 2007, 7:02pm UTC](https://forum.kirupa.com/t/clear-form-in-flash-with-php/222367 "2007-04-12T19:02:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hroth](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@hroth](https://forum.kirupa.com/u/hroth)\
**Post date:** [April 12, 2007, 7:02pm UTC](https://forum.kirupa.com/t/clear-form-in-flash-with-php/222367/1 "2007-04-12T19:02:51Z")

</div>

Hey all,

I have a mailform in flash that works great…  
only problem is that at the end of the .php file  
I have this clearing the fields in flash:

**[COLOR=green]print[/COLOR] [COLOR=darkred]"&contact\_bg.contact\_inside.MessageLong=&"[/COLOR][COLOR=green];[/COLOR]**

it works, but the variables are still there.  
If the person clicks again I get two emails…  
(same if they click 20 times )

I would like to clear the variables and be able to  
prevent double-clicking from sending two messages.

here is the complete script:

```php

<?php
 
$vars = array("name", "email", "message_l", "mail_list", "city", "links", "recip");
 
foreach($vars as $var)
 if(isset($_POST[$var]))
  $$var = $_POST[$var];
 else
  $$var = '';
 
if(strlen($name) < 2)
 die("&contact_bg.contact_inside.status1=please enter your name&");
if(!eregi('^([a-z0-9\._-])+@([^\.]+\.[^\.]+.*)', $email, $matched))
 die("&contact_bg.contact_inside.status1=please enter a correct email address&");
else if(!getmxrr($matched[2], $mxrr))
 die("&contact_bg.contact_inside.status1=your mail server does not seem to exist&");
 
$recip = "info@website.com";
 
$message = str_replace("\r", "
", $message);
 
$sender = $_SERVER[REMOTE_ADDR];
 
$mailbody = "Contact form sent by
Name: $name
Email: $email
City: $city
Links: $links
Join mailing list?: $mail_list
message:
$message_l
-------
sender's ip: $sender";
 
mail($recip, "Mail From:$name", $mailbody, "From: $email");
 
print "&contact_bg.contact_inside.status1=your message has been sent&";
print "&contact_bg.contact_inside.BasicName=&";
print "&contact_bg.contact_inside.BasicEmail=&";
print "&contact_bg.contact_inside.BasicCity=&";
print "&contact_bg.contact_inside.BasicLink=&";
print "&contact_bg.contact_inside.MessageLong=&";
?>

```

thanks in advance~!  
[COLOR=orange]-hroth:alien2: [/COLOR]
