Magento contact form redirect

sKippah

New Member
I'm new to Magento / PHP so please bare with me. I'm working on a new site build and the site has two contact forms which run off the same controller. At the moment the form on the contact page loads a small message saying 'thanks for your inquiry' etc.. The form on the 'gallery' page, once it's submitted sends the user to the contact page and displays the same message.However what I want is to keep the user on the page they are currently on and then display the message. Exactly what's currently happening on the contact page.If I change this piece of code:\[code\]$this->_redirect('*/*/');\[/code\]in /code/core/Mage/Contacts/controllers/IndexController.php I can get it to re-direct to the homepage etc but I just want it to display the message on the page i'm on.Here is the code to my form:\[code\]<form action="<?php echo Mage::getUrl(); ?>contacts/index/post/" id="contactForm" method="post"><input type='hidden' name='formtype' value='http://stackoverflow.com/questions/15907359/Contact Us Page'/> <div class="fieldset"> <ul class="form-list"> <li class="fields"> <div class="field"><div class="input-box"><input onfocus="if(this.value =http://stackoverflow.com/questions/15907359/='Name'){this.valuehttp://stackoverflow.com/questions/15907359/= '';}" name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" class="input-text required-entry" type="text" onblur="if(this.value =http://stackoverflow.com/questions/15907359/=''){this.value='http://stackoverflow.com/questions/15907359/Name';}" value="http://stackoverflow.com/questions/15907359/Name"/> </div> </div> <li><div class="input-box"><input name="company" id="company" onfocus="if(this.value =http://stackoverflow.com/questions/15907359/='Company'){this.valuehttp://stackoverflow.com/questions/15907359/= '';}" title="<?php echo Mage::helper('contacts')->__('Company') ?>" value="http://stackoverflow.com/questions/15907359/Company" onblur="if(this.value =http://stackoverflow.com/questions/15907359/=''){this.value='http://stackoverflow.com/questions/15907359/Company';}" class="input-text" type="text" /> </div> </li> <div class="field"> <div class="input-box"><input name="email" id="email" onfocus="if(this.value =http://stackoverflow.com/questions/15907359/='Email'){this.valuehttp://stackoverflow.com/questions/15907359/= '';}" title="<?php echo Mage::helper('contacts')->__('Email') ?>" value="http://stackoverflow.com/questions/15907359/Email" onblur="if(this.value =http://stackoverflow.com/questions/15907359/=''){this.value='http://stackoverflow.com/questions/15907359/Email';}" class="input-text required-entry validate-email" type="text" /> </div> </div> </li> <li class="wide"> <!--<label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Comment') ?></label>--> <div class="input-box"> <textarea name="comment" id="comment" onfocus="if(this.value =http://stackoverflow.com/questions/15907359/='Enquiry details'){this.valuehttp://stackoverflow.com/questions/15907359/= '';}" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" class="required-entry input-text" onblur="if(this.value =http://stackoverflow.com/questions/15907359/=''){this.value='http://stackoverflow.com/questions/15907359/Enquiry details';}" cols="5" value="http://stackoverflow.com/questions/15907359/Enquiry details" rows="3">Enquiry details</textarea> </div> </li> </ul> </div> <div class="buttons-set"><input type="text" name="hideit" id="hideit" value="" style="display:none !important;" /> <button class="submit" type="submit" title="<?php echo Mage::helper('contacts')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button></div></form><script type="text/javascript">//<![CDATA[ var contactForm = new VarienForm('contactForm', true);//]]></script>\[/code\]Any help would be much appreciated.
 
Top