This topic is locked

Enquiry Form

2/9/2009 11:25:20 AM
PHPRunner General questions
N
nickc25 author

Hi
My site requires an enquiry form for each individual villa, is there a way to do this within phprunner? Or modding the code afterwards? Each villa owner will input their villa and will be registered as a user, but I tried to do an enquiry form and it is the same form output for each villa, I used cgi form though so maybe there is a different form to use for this.
Basically someone should be able to click onto a villa and for that villa they can send an enquiry which would then go to that specific villa owner and not to me or site owners etc. Is there a way to do this and how?
Thanks
Nick

Sergey Kornilov admin 2/9/2009

You can use request form similar to one you can find in Cars template.
More info in your personal email.

N
nickc25 author 2/9/2009

You can use request form similar to one you can find in Cars template.

More info in your personal email.


Hiya I did try to add the cars template to my existing project but it somehow messed it up so starting again. All I need is that 1 form off that cars template lol
I didnt see a way to get a link to the form in the cars template from the vacation rentals "vacproperties". Even then how does it get configured so that the emails go to that specific villa owner? I think some coding might need to be done and Im not the man to do it lol
Im ok with tutorials and things but when I try to do things on my own is when I mess things up <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=37634&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />

N
nickc25 author 2/9/2009

This is the start of the code for my current enquiry form which is on a html page:
<FORM ACTION="http://disneyworldonline.co.uk/cgi-sys/FormMail.cgi";
METHOD="post" onsubmit="return FrontPage_Form3_Validator(this)" language="JavaScript" name="FrontPage_Form3">
<h1 align="center" style="height: 20px; width: 100%"><strong>

<span class="style57">Send Enquiry Form</span></strong><font size="2"><b><span class="style56"><strong><span class="style4"><INPUT NAME="recipient" TYPE="hidden" VALUE="dwo.023@disneyworldonline.co.uk"><input name="subject" type="hidden" value="Enquiry from DisneyWorldOnline.co.uk Villa Rentals ref dwo_023"><INPUT NAME="sort" TYPE="hidden"
As you see it uses formmail.cgi script and does not form part of a database. I do not really case about database as long as the emails are going to the right person. Currently each villa owner has a villa reference number and I have an email address setup for them which then forwards onto their own email address, so the enquiries can be kept that way anyway.
I have seen that this is the code I need to use with the form on the phprunner:
function BeforeAdd(&$values,&$message,$inline)

{

//Parameters:

//$values - Array object.

//Each field on the Add form is represented as a 'Field name'-'Field value' pair
//** Send email with new data ****
$email = "test@test.com";

$message_body = "";

$subject = "New data record";
foreach($values as $field=>$value)

$message_body.= $field." : ".$value."\r\n";
mail($email, $subject, $message_body);
return true;
//return true if you would like to proceed with adding the new record;

//return false otherwise

}
The $email field is test@test.com by default. How does it dynamically change to send to the specific username that created the advert? I think that is all I need to get my head around and then I can get it sorted out. Other than that the only way is to create lots of html pages for each owner and put a link but that would not be user friendly. So this is basically make or break whether I use php for my site or not. I am sure it can be done because vbulletin does it and many other php systems.
Thanks

Sergey Kornilov admin 2/9/2009

Answered to your personal email.