Jump to content

My custom form on product page doesn't go php script


Recommended Posts

Hi, I've made form like this in product.tpl in my theme directory and also php script in the same directory. My problem is, that it doesn't work, it doesn't go to script. Here is example:




Form is under gold button "Do koszyka", first two fields are required, third is optional (additional info) and last is required (email). If you notice some mistake, please let me know


Form in product.tpl

<form method = "post" action ={"../themes/villaitalia_gold/rent.php"}>
    <input name = "link" type = "hidden" value = {$smarty.server.HTTP_HOST}{$smarty.server.REQUEST_URI}>
    <label> Od
        <input name = "date_from" type = "date" required>
    <label> Do
        <input name = "date_to" type = "date" required>
    <label> Dodatkowe info
        <input name = "additional_info" type = "textarea">
    <label> Twój mail
        <input name = "email" type = "email" required>
    <input name = "submit" type = "submit">

Php script rent.php like this


$linkToProduct = $_POST['link'];
$dateFrom = $_POST['date_from'];
$dateTo = $_POST['date_to'];
$additionalInfo = $_POST['additional_info'];
$email = $_POST['email'];

$message = "Produkt: $linkToProduct \nOd: $dateFrom \nDo: $dateTo";

$recipient = "[email protected]";
$subject = "Wypozyczenie produktu";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $message, $mailheader);
header( 'Location: http://vigdm.no-restrictions.com/content/15-stylizacja-wyslana-do-wyceny') ;
Edited by stolarz (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...