Multiple dynamic contact forms
I have built a inquiry form on my website, the idea is instead of mailing
me each time a user submits a query it is added to my database which I can
then go and view via my backend system
Each query will be listed one by one with a text-area contact form below
it allowing me to reply to each query individually
So far I have this (sorry it's a bit messy)
foreach ($listings as $row){
$loop.= "<h3 class='text-center'>".$row['question']."</h3>";
$loop.= "<p>".$row['message']."</p>";
$loop.= "Name: <b>".$row['name']."</b>";
$loop.= "<span class='pull-right'>Email:
<b>".$row['email']."</b><br></span>";
$loop.= "<div class='clearfix'></div>";
if(isset($row['website'])){ $loop.="Website:
<b>".$row['website']."</b>"; }
$loop.= "<span class='pull-right'>Date: <b>".$row['date']."</b></span>";
$loop.= "<form name='submit-response' method='POST'><fieldset>";
$loop.= "<div class='form-group'> <label
for='Message".$counter."'>Your Message</label> <textarea
id='Message".$counter."' name='Message".$counter."'
class='form-control' rows='5'></textarea> </div>";
$loop.= "<button type='submit' name='submit".$counter."' class='btn
btn-default btn-block'>Reply</button>";
$loop.= "</fieldset></form>";
}
Before that is a foreach loop and the start of the oh and $counter is set
to nill
What I want is for each contact form to be unique so when I click send on
one of the queries it will be sent and removed so I can send another, the
only issue I am having is working out how I will work out if a submit has
been hit, and which submit has been hit
The code will need to workout which button has been hit and depending on
which button it will then mail() to the recipient
I'm quite stuck on this one and I'm not sure of the best course of action
so any advice is really appreciated
Luke
No comments:
Post a Comment