Announcement

Collapse
No announcement yet.

Calling a different CGI script when clicking a button?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Calling a different CGI script when clicking a button?

    I am trying to add an additional form processing script to our store.

    A while ago I changed the MailForm.pl to process additional fields, and I changed the contact form to allow this, but due to customers not reading the forms as they fill them in, I wanted to try something different.

    With this in mind, I've changed the MailForm.pl and Act_ContactUs.html back to as they were, and I've added an alternate form processor to the CGI-BIN folder of the web server.

    I've tested the form and processor and they both work in a section of our site, separate from the store.

    To integrate this new form and form processor with the store, I've got a separate section of the store filled with fragments. One of these fragments has the code I require for the additional form entry, and the action in the form header calls the new script. The code is as follows:

    Code:
    <form method="POST" action="/cgi-bin/nmfp0001.pl">
    <table cellpadding="3" cellspacing="0">
      <tr> 
        <td><span class="actrequiredcolor"><b>Full name:</b></span></td>
        <td> <input type="TEXT" name="name" size="50" maxsize="125"> 
        </td>
      </tr>
      <tr> 
        <td><span class="actrequiredcolor"><b>Email address:</b></span></td>
        <td> <input type="TEXT" name="emailaddress" size="50" maxsize="125"> 
        </td>
      </tr>
    <tr>
    	<td colspan="2"><hr> </td>
      </tr>
        <tr> 
        <td><span class="actrequiredcolor"><b>Address 1:</b></span></td>
        <td> <input type="TEXT" name="address1" size="50" maxsize="125"> 
        </td>
      </tr>
      <tr> 
        <td>Address 2:</td>
        <td> <input type="TEXT" name="address2" size="50" maxsize="125" value=""> 
        </td>
      </tr>
      <tr> 
        <td><span class="actrequiredcolor"><b>Town / city:</b></span></td>
        <td> <input type="TEXT" name="city" size="50" maxsize="125" value=""> 
        </td>
      </tr>
      <tr> 
        <td>County</td>
        <td> <input type="TEXT" name="county" size="50" maxsize="125" value=""> 
        </td>
      </tr>
      <tr> 
        <td><span class="actrequiredcolor"><b>Country:</b></span></td>
        <td> <input type="TEXT" name="country" size="50" maxsize="125" value=""> 
        </td>
      </tr>
        <tr> 
        <td><span class="actrequiredcolor"><b>Postcode:</b></span></td>
        <td> <input type="TEXT" name="postcode" size="10" maxsize="20" value=""> 
        </td>
      </tr>
    <tr> 
        <td><span class="actrequiredcolor"><b>Telephone:</b></span></td>
        <td> <input type="TEXT" name="telephone" size="20" maxsize="40" value=""> 
        </td>
      </tr>
    <tr> 
        <td valign="top">&nbsp;</td>
        <td><input type="SUBMIT" value="Send"> </td>
      </tr>
    </table>
    </form>
    This displays perfectly in the browser, and everything works as it should, until you press the Send button.

    When you press the Send button, instead of calling the noted CGI script, it calls the /cgi-bin/ca000001.pl script instead, which results in:
    A General Script Error Occurred
    Error: Could not locate the product reference.
    So my question is: how can I call the required /cgi-bin/nmfp0001.pl script, without having the /cgi-bin/ca000001.pl script kicking in instead?

    All help gratefully received ...

    #2
    Because you have it within the main area of the template and body as viewed, the script you are dropping in is already surrounded by the cart scripts, so you would need to first of all close the form off </form> and then after your bit, reopen it again (which eludes me right now), but a search of the forum on that or the advanced user guide will show it, but thats the issue I think.

    Comment


      #3
      Thanks for that. It works now!

      Comment

      Working...
      X