I'm having troubles in getting the current URL from which the filled form was send.
I want to use the same form for more sites.
This is my form code:
<form method="post" action="send_c_box.php">
<input type="text" class="textbox" name="meno" value="meno" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'meno a priezvisko';}">
<input type="text" class="textbox" name="email" value="email" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'e-mail';}">
<input type="hidden" name="current_url" value="<?php echo'http://',$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];?>" readonly/>
<div class="clear"></div>
<div>
<textarea value="Vaša správa:" name="mytext" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Vaša správa...';}">Vaša správa...</textarea>
</div>
<span><input type="submit" name="submit" class="" value="Odoslať"></span>
</form>
And PHP that sends emails. I need its $message to show URL, but I couldnt get it to work by calling $url
<?php
header( "refresh:3;url=index.html" );
if(isset($_POST['submit'])) {
$to = "[email protected]";
$from = $_POST['email'];
$first_name = $_POST['meno'];
$url = $_POST['current_url'];
$subject = "Správa z kontaktného formuláru";
$subject2 = "Potvrdenie o odoslaní formuláru";
$message = $first_name . " napísal vo formulári:" . "\n\n" . $_POST['mytext'] . "from" . $url;
$message2 = "Dakujeme za odoslanie formuláru. V krátkom case Vás kontaktujeme.";
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2);
echo "Dakujeme za odoslanie vyplneného formuláru " . $first_name . ", za okamih budete presmerovaný spät.";
}
?>
Where am I going wrong?