Bootstrap 3 Collapse Menus - javascript

I have been having an issue with a website I have been developing. I am a beginner with javascript so sorry in advance for a dumb question. On the websites www.dynamitecoffeeco.com I have two different things each in their own container. When you click on the menu button, and then click on the search button, I would like one to close out and then the other open. I have tried using other solutions but they all are tailored to the accordion markup. Any and all help would be appreciated. And here is the code as well.
The nav collapse is the container holding the menu and the search collapse is holding the search bar. Thanks again.
<div id="nav-collapse" class="collapse">
<div class="wrapper">
<div class="row">
<?php wp_nav_menu(); ?>
</div>
</div>
</div>
<div id="search-collapse" class="collapse">
<div class="wrapper">
<div class="row">
<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
<label>
<input type="search" width="100%" class="search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder' ) ?>" value="<?php echo get_search_query() ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label' ) ?>" />
</label>
</form>
</div>
</div>
</div>

Ok it took me some time to understand the problem but here goes.
First of all you have to put the class 'in' in your 'default' opened menu, probably #nav-collapse:
<div id="nav-collapse" class="collapse in">
Now in the link that opens the search button you should write:
<a data-toggle="collapse" href="#search-collapse">
in the link that goes back to the navigation menu use this code:
<a data-toggle="collapse" href="#nav-collapse">
This assumes you have properly loaded jquery/bootstrap.js/bootstrap.css

Related

Scroll to position inside bootstrap panel

I have a panel(bootstrap) with a lot of results from my database. when I click on 1 of the results, it will open a side window with details.
Sometimes I have the panel filled with 100+ rows, so when I scroll down and click on 1 of the href's, it will refresh and go back to top.
What I want: When I click on the href, it will scroll back to this href inside the panel.
What i've tried? a lot.....
What came close? get the scroll pos with javascript using this:
window.addEventListener("scroll", function (event) {
var scroll = this.scrollY;
console.log(scroll)
});
This only works with the main scrollbar. does not give the pos from my scrollbar inside the panel
Some pictures:
A bit more info: when I click on the href, i redirect to another page with the same panel & href list as the previous page.
This is a small and cropped part of the script:
<div class="row">
<div class="col-lg-8">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa-fw"></i>Job lijst voor resource id:
<span style="float:right;">
<a class="btn btn-link" href="javascript:history.back()">
<i class="fa fa-arrow-circle-o-left" aria-hidden="true"></i> Terug
</a>
</span>
</div>
<div class="panel-body col-lg-12" style="overflow-y: auto; height: 700px">
<div class="list-group">
<?php
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
?>
<a href="blablablabla" class="list-group-item" style="background-color: #<?php echo $fontColor; ?>">
<!-- background color to highlight the selected href -->
<div style="text-align:left">
<div class="row">
Some info from the database
</div>
</div>
</a>
<?php
}
?>
</div>
</div>
</div>

Opening the javascript action only when clicking a specific section of the div

I am working on an albums page , and i have this script that will open the image in a bigger window so i can see it better, zoom , download, etc.
I modified it a little , and i am generating the pictures in a foreach from my database.
<div id="lightgallery" class="row" >
<?php $x=1; ?>
<?php foreach ($this->upload as $upload): ?>
<?php $dir = Users::currentUser()->id; ?>
<div class="col-sm-3" data-src="<?= PROOT . 'files' . DS . $dir . DS . $upload->name ;?>" data-sub-html="<h4><?=$upload->name ?></h4>">
<div class="thumbnail text-center">
<img src="<?= PROOT . 'files' . DS . $dir . DS . $upload->name ;?>" alt="Thumb-<?=$x?>" class="imgu">
</div>
<div class="caption text-center">
<hr>
<p><?= $upload->name;?> </p>
<div class="text-center">
<a href="<?=PROOT?>upload/delete/<?=$upload->id?>" class="btn btn-danger btn-xs " onclick="if(!confirm('Are you sure ?')){return false;} target='_blank' ">
Delete
</a>
</div>
</div>
</div>
<?php $x++; ?>
<?php endforeach; ?>
</div>
The only problem i have with it so far is that i want the picture to be opened only when i click on the picture , but it opens the picture, no matter where i click on the div. Even if i click on the button Delete it will open the picture in a bigger window as the script does.
And the javascripts required as they are hidden on codepin.io
<script src="https://cdn.rawgit.com/sachinchoolur/lightgallery.js/master/dist/js/lightgallery.js"></script>
<script src="https://cdn.rawgit.com/sachinchoolur/lg-autoplay.js/master/dist/lg-autoplay.js"></script>
<script src="https://cdn.rawgit.com/sachinchoolur/lg-fullscreen.js/master/dist/lg-fullscreen.js"></script>
<script src="https://cdn.rawgit.com/sachinchoolur/lg-zoom.js/master/dist/lg-zoom.js"></script>
<script> lightGallery(document.getElementById('lightgallery')); </script>
Use selector option while creating light gallery to set the selector for opening the gallery,
<div class="col-sm-3">
<div class="thumbnail text-center">
<img src="https://dummyimage.com/300" alt="Thumb" class="imgu" data-src="https://dummyimage.com/300" data-sub-html="<h4>name </h4>">
</div>
<div class="caption text-center">
<hr>
<div>
test div
</div>
<div class="text-center">
<a href="<?=PROOT?>upload/delete/<?=$upload->id?>" class="btn btn-danger btn-xs " onclick="if(!confirm('Are you sure ?')){return false;} target='_blank' ">
Delete
</a>
</div>
</div>
</div>
</div>
<script>
lightGallery(document.getElementById('lightgallery'), {
selector: ".imgu"
});
</script>
in the above code, I used the image with class 'imgu' as the selector for gallery hence it will only open when the image is clicked, also provide the data-src and data-sub-html for the img tag
check the below fiddle
https://jsfiddle.net/suhailsulu/Lya1hdtm/

i would like to open comments and comments input form in a modal popup

Here is my problem
where this button - link - php call:
<a href="<?php bp_activity_comment_link(); ?>" class="fa fa-reply
acomment-reply bp-primary-action " id="acomment-comment-<?php
bp_activity_id(); ?>"><div class="comnekaj">Comment</div></a>
opens this form as a inline slide down:
<form action="<?php bp_activity_comment_form_action(); ?>" method="post"
id="ac-form-<?php bp_activity_id(); ?>" class="ac-form"<?php
bp_activity_comment_form_nojs_display(); ?>>
<?php bp_activity_comments(); ?>
<div class="ac-reply-avatar"><?php bp_loggedin_user_avatar(
'width=70&height=70' ); ?></div>
<div class="ac-reply-content">
<div class="ac-textarea">
<textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input bp-
suggestions" name="ac_input_<?php bp_activity_id(); ?>"></textarea>
</div>
<input type="submit" name="ac_form_submit" value="<?php esc_attr_e(
'Comment', 'buddypress' ); ?>" /> <a href="#" class="ac-reply-
cancel"><?php _e( 'Cancel', 'buddypress' ); ?></a>
<input type="hidden" name="comment_form_id" value="<?php
bp_activity_id(); ?>" />
</div>
<?php do_action( 'bp_activity_entry_comments' ); ?>
<?php wp_nonce_field( 'new_activity_comment',
'_wpnonce_new_activity_comment' ); ?>
</form>
i am trying for more than a week now to display this inline form on the mentioned button click to show as a modal popup and am unable to succeed.
one of the problems i faced was how to sticky this on the bottom of the modal, to make it a bit more user friendly:
<div class="ac-textarea">
<textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input bp-
suggestions" name="ac_input_<?php bp_activity_id(); ?>"></textarea>
</div>
<input type="submit" name="ac_form_submit" value="<?php esc_attr_e(
'Comment', 'buddypress' ); ?>" /> <a href="#" class="ac-reply-
cancel"><?php _e( 'Cancel', 'buddypress' ); ?></a>
<input type="hidden" name="comment_form_id" value="<?php
bp_activity_id(); ?>" />
</div>
on bottom of the modal...
Do you have any suggestions how to solve this?
edit:
as per member request here is the html of the parts of the page i was talking about...
<div class="activity-meta">
here is the link that opens the input text box and the comments:
<a href="?ac=14688/#ac-form-14688" class="fa fa-reply acomment-reply bp-
primary-action " id="acomment-comment-14688"><div
class="com1">Comment</div></a>
and this is the form that should open in modal popup in this example it has comments....
<div class="activity-comments">
and this form i would like to display as popup with
<form action="https://test.com/.../reply/" method="post" id="ac-form-14688"
class="ac-form">
<ul>
<li id="acomment-14690">
<div class="acomment-avatar">
<a href="https://test.com/members/.../">
<img src="https://test.com/wp-content/uploads/avatars/2347/5a32cc81b1bb9-
bpthumb.jpg" class="avatar user-2347-avatar avatar-50 photo" width="50"
height="50" alt="Profile picture of ..." /> </a>
</div>
<div class="acomment-meta">
... replied <a
href="https://test.com/.../p/14688/#acomment-14690" class="activity-time-
since"><span class="time-since">15 hours, 15 minutes ago</span></a> </div>
<div class="acomment-content"><p>I try and main line mine… </p>
</div>
<div class="acomment-options">
<a href="#" class="bp-secondary-action buddyboss_edit_activity_comment"
onclick="return buddypress_edit_activity_initiate(this);" data-
activity_id="14690">
Edit </a>
<a href="https://test.com/delete/14690/?cid=14690&_wpnonce=2c0babed04"
class="delete acomment-delete confirm bp-secondary-action"
rel="nofollow">Delete</a>
</div>
</li>
<li id="acomment-14691">
<div class="acomment-avatar">
<a href="https://test.com/members/,,,/">
<img src="https://test.com/wp-
content/uploads/avatars/3604/5bf70260a4f3a-bpthumb.jpg" class="avatar user-
3604-avatar avatar-50 photo" width="50" height="50" alt="Profile picture of
,,," /> </a>
</div>
<div class="acomment-meta">
,,, replied <a
href="https://test.com/.../p/14688/#acomment-14691" class="activity-time-
since"><span class="time-since">15 hours, 12 minutes ago</span></a> </div>
<div class="acomment-content"><p>Yes I done that before is good
technique</p>
</div>
<div class="acomment-options">
<a href="#" class="bp-secondary-action buddyboss_edit_activity_comment"
onclick="return buddypress_edit_activity_initiate(this);" data-
activity_id="14691">
Edit </a>
<a href="https://test.com/delete/14691/?
cid=14691&_wpnonce=2c0babed04" class="delete acomment-delete confirm
bp-secondary-action" rel="nofollow">Delete</a>
</div>
</li>

how can i get the php value(id) from a span and use it in a modal window

i created an articles and each article has an id. i made a modal window for viewing the detailed articles inside modal window you can insert a comment and like the article but the problem is when i tried to click the other article the id that he gets is only the first id that was created.what i wanted to do is that when i tried to click the article it will get the article id and show it to the modal.
here is my sample code.
this is the button that i clicked for me to show the modal window
span style="color:#59960b;" class="read" data-toggle='modal' data-target="#myModal">Read more..</span><input type="hidden" value="<?php echo $articleid; ?>"></span>
MODAL WINDOW
<?php
$output = $db->viewArticle($articleid);
foreach ($output as $key):
if($key['art_id'] == $articleid){
?>
<!--view Modal content-->
<div id="articlepost" class="modal-content-article">
<div class="modal-header-article">
<input type="hidden" name="aid" id="aid" value="<?php echo $articleid ?>"/>
<button type="button" style="padding-left:1155px;position:fixed;" class="close" data-dismiss="modal">×</button>
<img src="./<?= $key['art_cphoto'];?>" style="margin-left:100px;"/>
</div>
<div class="modal-body">
<div align="center" style="color:#222;">
<strong class="font-2" id="title"><?php echo $arttitle ?></strong>
<?php }?>
<?php
foreach ($db->countarticlecomment($articleid) as $value) {
?>
<span class="font-1-2" style="margin-right:10px;">
<i class="fa fa-comment" style="color:#59960b;"></i> <span style="color:gray;"><b><?php echo $value['comments']?></b></span> 
</span>
<hr>
<?php }?>
</div>
</div>
<?php
$out = $db->articleviewcount($articleid);
foreach ( $db->viewarticlecomment() as $value) {
if($articleid = $value['artid']){
?>
<div id="mycomments" class="col-lg-8" style="background:#eff9c7;color:#222;margin-left:170px">
<span class="" style="margin-left:10px;font-size:.9em;color:gray;"><abbr class="timeago" title="<?php echo $value['artsend']?>"></abbr></span>
</p>
</div>
<?php
}
}
?>
<div class="col-lg-8" style="background:#eff9c7;margin-left:170px">
<br>
<input type="text" name="artcomment" id="artcomment" class="form-control pull-right" style="width:92%;margin-top:5px;margin-bottom:10px;" placeholder="Comments..." />
<br><br>
</div>
<?php endforeach ?>
<br>
<div class="row">
</div>
<br>
</div>
</div>
</div>
how can i get the value of the $articleid so that when i clicked one of the articles it will send the (id)value to the modal window so that the id of the article will be the one to shown. i tried using jquery to get the $articleid and it works but my problem is how can i use the id from my jquery to my modal? i tried searching and they said to use ajax. i tried it also and declared my modal window in a variable but my concern is my modal has 2 forloops inside and also when i tried to use the jquery function only the latest article is clickable not the other articles. even if i can get the id of the article if i cannot clicked the other article it doesn't make anysense. so is there any way i can get the id and use it in a modal..? btw this script is both inside 1php file.
I would recommend that you use the Global data attribute to send the article id to the modal. You can learn about the data attribute here:
https://www.w3schools.com/tags/att_global_data.asp.
Below is a code snippet that shows how the data attribute works.
You'll notice that in the button there is an custom data attribute called data-articleid and that I have set it's value to xyz. You would set it's value to <?php echo $articleid ?>. I can't use php here.
When the button openBtn is clicked, a function is called and a variable called articleId gets the value of the attribute data-articleid and then sets the text of title inside the modal to articleId.
// function to open the modal, get the data attribute, and set the title text
$('#openBtn').click(function() {
$('#myModal').modal('show');
var articleId = openBtn.getAttribute("data-articleid");
$('#title').text(articleId);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Trigger the modal with a button -->
<!-- I can't use php in this snippet so I'm just hardcoding a data-articleid of "xyz". You should echo your article id instead. -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-articleid="xyz" id="openBtn">Open Modal</button>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title" id="title"></h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Maybe you could output all articles as their own modals and assign them their own ID's, so that they wouldn't be named as myModal (<div id="myModal) but instead myModal1, myModal2etc.
Then the links would look like this
<span style="color:#59960b;" class="read" data-toggle='modal' data-target="#myModal<?php echo $articleid; ?>">Read more..</span>
This would work if you don't have too many articles, if there is a lot of data, you should use Ajax.

use php to populate form fields [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
Ok, I'm at my wits end here. I'm making a website for a friend, to showcase his work. Each piece has it's own page. On those pages, we have a link
<a class="btn" href="../contact_2.html">Contact us about this item</a>
that takes us to the contact form page, where the user is expected to fill income details before getting in touch. What we want to do is have the 'subject' field filled with the name of the subject of the page the link was clicked form. i.e. you're on (../port_pages/38mmspruce.html), you click the "contact us about" link, and when you get to the page "contact.html", the subject field already has "38mmSpruce" populated.
As it stands, the form functions perfectly - the $_POST method is in use, and it sends the form as it should. However, trying to get the subject field to populate is driving me round the bend. The closest I got was with this html:
<label for="subject">Subject *</label>
<input id="subject" type="text" name="subject" class="form-control"
placeholder="Please enter the subject you'd like to discuss *"
value="<? php echo $_POST='subject'?>"
rows="1" required="required">
which fills the subject field with:
<? php echo $_POST='subject' ?>
rather than the ACTUAL subject. I've tried this also where I've changed every occurrence of $_POST to $_GET, but it returns the same result. If I change the anchor to:
<a class="btn" href="../contact.php">Contact us about this item</a>
It fires an email off without loading the form page. I've tried adding query strings to the anchor too, but they don't return any data. I know this must be really simple but I've been banging my head against it for nearly a week now, and despite trying to research every possible variation on this question, I can't find the right answer. Here is the code for the relevant pages:
contact.php
<?php
$from = 'Demo contact form <example#example.com>';
$sendTo = 'Demo contact form <example#example.com>';
$subject = $_POST['subject'];
$fields = array('name' => 'Name', 'email' => 'Email', 'subject' =>
'Subject', 'message' => 'Message');
$okMessage = 'Contact form succesfully submitted. Thank you, I will get
back to you soon!';
$errorMessage = 'There was an error while submitting the form. Please
try again later';
try
{
$emailText = "You have new message from contact
form\n=============================\n";
foreach ($_POST as $key => $value) {
if (isset($fields[$key])) {
$emailText .= "$fields[$key]: $value\n";
}
}
mail($sendTo, $subject, $emailText, "From: " . $from);
$responseArray = array('type' => 'success', 'message' => $okMessage);
}
catch (\Exception $e)
{
$responseArray = array('type' => 'danger', 'message' => $errorMessage);
}
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$encoded = json_encode($responseArray);
header('Content-Type: application/json');
echo $encoded;
}
else {
echo $responseArray['message'];
}
?>
conatact.js
$(function () {
$("#contact-form").submit(function () {
var url = "contact.php";
$.ajax({
type: "POST",
url: url,
data: $(this).serialize(),
success: function (data)
{
var messageAlert = 'alert-' + data.type;
var messageText = data.message;
var alertBox = '<div class="alert ' + messageAlert + '
alert-dismissable"><button type="button" class="close" data-
dismiss="alert" aria-hidden="true">×</button>' + messageText +
'</div>';
if (messageAlert && messageText) {
$('#contact-form').find('.messages').html(alertBox);
$('#contact-form')[0].reset();
}
}
});
return false;
});
});
And finally, the form part of the html (edit. full page posted as requested)
<body>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-
toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">Those That
Know</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-
collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
Home
</li>
<li>
About
</li>
<li>
Portfolio
</li>
<li class="active">
Contact
</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
</nav>
<!-- Page Content -->
<div class="container">
<!-- Page Heading/Breadcrumbs -->
<div class="row">
<div class="col-lg-12 text-left">
<h1 class="page-header">Contact
<small>Get in touch</small>
</h1>
<ol class="breadcrumb">
<li>Home
</li>
<li class="active">Contact</li>
</ol>
</div>
</div>
<!-- /.row -->
<!-- Content Row -->
<!-- Map Column -->
<!-- Contact Details Column -->
<div class="row">
<div class="col-md-6">
<img class="img-responsive" src="images/About Main Pic.png"
alt="">
</div>
<div class="col-md-6">
<h2>Contact Details</h2>
<h2>Those That Know HQ<br>Wallsend-on-Tyne<br>
</h2>
<p><i class="fa fa-envelope-o"></i>
<abbr title="Email">E</abbr>: example#example.com
</p>
<p><i class="fa fa-clock-o"></i>
<abbr title="Hours">H</abbr>: Open 24 hours</p>
<ul class="list-unstyled list-inline list-social-icons">
<li>
<a class="btn btn-social-icon btn-facebook"
href="#"><i class="fa fa-
facebook-square fa-2x"></i></a>
</li>
<li>
<a class="btn btn-social-icon btn-envelope"><i
class="fa fa-envelope-square fa-2x"></i></a>
</li>
<li>
<a class="btn btn-social-icon-large btn-instagram"
href="#"><i class="fa fa-instagram fa-2x"></i></a>
</li>
<button onclick="goBack()">Back</button>
</div>
</div>
</ul>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1>Get in touch with <a href="contact_2.html">Those
That Know</a></h1>
<p class="lead">If you'd like to contact me about
placing an order, or about anything you've seen on the site, please
fill in the form below.</p>
<p>Please include information about the piece you've
been looking at. It'll help us to get started on your order.</p>
<form id="contact-form" method="post"
action="contact.php" name="contact-form" role="form">
<div class="messages"></div>
<div class="controls">
<div class="row">
<div class="col-md-6">
<label for="form_name">Name *</label>
<input id="form_name" type="text"
name="name" class="form-control" placeholder="Please enter your name
*" required="required">
</div>
<div class="col-md-6">
<label for="form_email">Email *</label>
<input id="form_email" type="email"
name="email" class="form-control" placeholder="Please enter your email
*" required="required">
</div>
<div class="col-md-12">
<label for="form_subject">Subject *
</label>
<input id="form_subject" type="text"
name="subject" class="form-control" placeholder="Please enter the
subject you'd like to discuss *"
value="<? php echo $_POST['subject'];?
>"
rows="1" required="required">
</div>
<div class="col-md-12">
<label for="form_message">Message *
</label>
<textarea id="form_message"
name="message" class="form-control" placeholder="Your message here *"
rows="4" required="required"></textarea>
</div>
<div class="col-md-12">
<input type="submit" class="btn btn-
success btn-send" value="Send message">
</div>
<div class="col-md-12">
<p class="text-muted"><strong>*
</strong> These fields are required.</p>
</div>
</div>
</div>
</form>
</div><!-- /.8 -->
</div> <!-- /.row-->
<!-- /.container-->
<footer>
<div class="row">
<div class="col-lg-12">
<p>Copyright © Those That Know 2016</p>
</div>
</div>
</footer>
<script>
function goBack() {
window.history.back();
}
</script>
<script src="https://code.jquery.com/jquery-1.12.0.min.js">
</script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/
bootstrap.min.js">
</script>
<script src="js/contact.js"></script>
</body>
</html>
As you can see, it's a Bootstrap form, and the .js and .php files came with it. I've changed the mail settings to real ones for testing to make sure it works, which it does, but I simply cannot figure out how to make the php 'echo' the subject from a page into the relevant field in the form. I've also removed all of my attempts at adding query strings after the page name in the link because I couldn't make any of them work. I really need a straight up answer to this puzzler-this is the 3rd time I've asked on here, and nothing is working. I think it's obvious that I have very weak skills, but I'm working on them and fixing this problem would really help me to move on to a new set of problems.
Your help is gratefully appreciated in advance.
Rename your contact_2.html to contact_2.php so it gets parsed by the PHP interpreter.
Change the href in
<a class="btn" href="../contact_2.html">Contact us about this item</a>
accordingly.
Finally replace your <? php echo $_POST='subject' ? > to
<?php if (!empty($_POST['subject'])) echo $_POST['subject']; ?>
like #manniL said.
Instead of echo $_POST='subject', use the correct syntax here:
echo $_POST['subject'];

Categories