SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript form in PHP

    I was wondering if anyone could give me some pointers on converting this form to php?

    I would like to use the post method. I know how to construct the URL but once the URL is constructed what do I do with it? Here is the script provided by the vendor and it's using javascript.

    Code:
    //This JavasScript command pulls data from the form and submits it to STARS.
    script language=JavaScript>
    function CallForm()
    {
    var URLHold
    ="https://stars.trainingmasters.com:81/INBLEADS.pgm?task=endadd&SelComp=XXXX&SelResponse=P&ReturnURL=http://www.careerta.edu/thankyou.html&B
    NJJTX=" + document.getElementById('BNJJTX').value + "&BNJITX=" + document.getElementById('BNJITX').value + "&STARPHONE=" +
    document.getElementById('BNQ0NB').value + "&BNJLTX=" + document.getElementById('BNJLTX').value + "&BNJNTX=" +
    document.getElementById('BNJNTX').value + "&BNC0CD=" + document.getElementById('BNC0CD').value + "&BNC1CD=" +
    document.getElementById('BNC1CD').value + "&BNQ6NB=" + document.getElementById('BNQ6NB').value + "&BNHXCD=WWW&LM5EM1=" +
    document.Form1.from.value;
    document.Form1.redirect.value = URLHold;
    }
    </script>
    //
    <center><form method="post" name="Form1" action="http://www.aweber.com/scripts/addlead.pl">
    <table>
    <tr><td colspan=2><center>Please contact me about Career College Academy<br/></center></td></tr>
    <tr><td>First Name:</td><td><input type="text" id='BNJJTX' name="custom first_name" value="" size="20"></td></tr>
    <tr><td>Last Name:</td><td><input type="text" id='BNJITX' name="custom last_name" value="" size="20"></td></tr>
    <tr><td>Email:</td><td><input type="text" name="from" value="" size="20"></td></tr>
    <tr><td>Phone :</td><td><input type="text" id='BNQ0NB' name="custom phone" value="" size="20"></td></tr>
    <tr><td>Address:</td><td><input type="text" id='BNJLTX' name="custom address" value="" size="20"></td></tr>
    <tr><td>City :</td><td><input type="text" id='BNJNTX' name="custom city" value="" size="20"></td></tr>
    <tr><td>State:</td><td><select id='BNC0CD' name="custom state">
    <option value=" "> </option>
    <option value="AK">AK</option>
    <option value="SC">SC</option>
    .
    .
    <option value="WI">WI</option>
    <option value="WY">WY</option>
    </select></td></tr>
    <tr><td>Zip:</td><td><input type="text" id='BNC1CD' name="custom zip" value="" size="20"></td></tr>
    // These programs of interest have direct correlation to STARS program IDs
    <tr><td>Program Interest:</td><td><select id='BNQ6NB' name="custom Program_Interest">
    <option value=005000000000>Medical Assistant</option>
    <option value=015000000000>Accounting</option>
    <option value=023000000000>Medical Billing/Coding</option>
    <option value=999999999999>Not Sure</option>
    </select></td></tr>
    //This line tells the form to also submit to STARS using JavaScript whenever the SUBMIT button is pressed.
    <tr><td align="center" colspan="2"><input type="submit" value="Submit"
    onclick="Javascript:CallForm();"></td></tr>
    </table>
    </form></center>

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2013
    Posts
    31
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You can just change the form action to PHP page or can post to same page, and remove onclick="javascript: CallForm();" code from submit button

    Code:
    <center><form method="post" name="Form1" action="">
    <table>
    <tr><td colspan=2><center>Please contact me about Career College Academy<br/></center></td></tr>
    <tr><td>First Name:</td><td><input type="text" id='BNJJTX' name="custom first_name" value="" size="20"></td></tr>
    <tr><td>Last Name:</td><td><input type="text" id='BNJITX' name="custom last_name" value="" size="20"></td></tr>
    <tr><td>Email:</td><td><input type="text" name="from" value="" size="20"></td></tr>
    <tr><td>Phone :</td><td><input type="text" id='BNQ0NB' name="custom phone" value="" size="20"></td></tr>
    <tr><td>Address:</td><td><input type="text" id='BNJLTX' name="custom address" value="" size="20"></td></tr>
    <tr><td>City :</td><td><input type="text" id='BNJNTX' name="custom city" value="" size="20"></td></tr>
    <tr><td>State:</td><td><select id='BNC0CD' name="custom state">
    <option value=" "> </option>
    <option value="AK">AK</option>
    <option value="SC">SC</option>
    .
    .
    <option value="WI">WI</option>
    <option value="WY">WY</option>
    </select></td></tr>
    <tr><td>Zip:</td><td><input type="text" id='BNC1CD' name="custom zip" value="" size="20"></td></tr>
    // These programs of interest have direct correlation to STARS program IDs
    <tr><td>Program Interest:</td><td><select id='BNQ6NB' name="custom Program_Interest">
    <option value=005000000000>Medical Assistant</option>
    <option value=015000000000>Accounting</option>
    <option value=023000000000>Medical Billing/Coding</option>
    <option value=999999999999>Not Sure</option>
    </select></td></tr>
    //This line tells the form to also submit to STARS using JavaScript whenever the SUBMIT button is pressed.
    <tr><td align="center" colspan="2"><input type="submit" value="Submit"></td></tr>
    </table>
    </form></center>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •