Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 4 of 4

Thread: Form help

  1. #1
    Join Date
    Apr 2008
    Posts
    39
    Tokens
    0

    Default Form help

    Right, i have an email form, but the thing i am wanting to do with this email form, is to make it output in a table, because i will be using it for an invoice sort of system, so i am wanting to have a form for staff to submit, put all the information in, the email that they are wanting to send it to and then it sends it in a nice neat table to the recipient, any way of doing this

    Thanks for all your help :]

  2. #2
    Join Date
    Apr 2008
    Posts
    39
    Tokens
    0

    Default

    Code:
    <?php
    if (isset($_REQUEST['Submit'])) {
    # Feudel.co.uk Advertising Manager
    $sql = "INSERT INTO $db_table(RefNum,Site,Contact,AddressLine1,AddressLine2,TownCounty,PostCode,TelNo,InvoiceEmail,PayMethod,StartDate,EndDate,bannerurl) values ('".mysql_real_escape_string(stripslashes($_REQUEST['RefNum']))."','".mysql_real_escape_string(stripslashes($_REQUEST['Site']))."','".mysql_real_escape_string(stripslashes($_REQUEST['Contact']))."','".mysql_real_escape_string(($_REQUEST['bannerurl']))."','".mysql_real_escape_string(($_REQUEST['TelNo']))."','".mysql_real_escape_string(($_REQUEST['InvoiceEmail']))."','".mysql_real_escape_string(($_REQUEST['PayMethod']))."','".mysql_real_escape_string(($_REQUEST['StartDate']))."','".mysql_real_escape_string(($_REQUEST['EndDate']))."','".mysql_real_escape_string(($_REQUEST['AddressLine1']))."','".mysql_real_escape_string(($_REQUEST['AddressLine2']))."','".mysql_real_escape_string(($_REQUEST['TownCounty']))."','".mysql_real_escape_string(($_REQUEST['PostCode']))."')";
    if($result = mysql_query($sql ,$db)) {
    echo '<div class="ocontentsection">
    <div class="contenttext"><table class="gltable" cellpadding="0" cellspacing="0"><center>Thank you<br>Your information has been entered.<br><img src="http://www.feudel.co.uk/arcade/plugins/site/themes/GreyJohnsSkin/header/header_r1_c1.gif"><br><br><a href="http://www.feudel.co.uk/arcade/ads">Return</a>';
    } else {
    echo "ERROR: ".mysql_error();
    }
    } else {
    ?><div class="ocontentsection">
    <div class="contenttext"><table class="gltable" cellpadding="0" cellspacing="0"><center>
    If you have accepted an advertisement, Please enter information here, a reference number will then be generated and all staff will use this number when contacting the buyer of advertisements!</center>
    <form method="post" action="">
    <center>
    <input type="hidden" name="RefNum" value="<?php $random = rand(000000000,999999999); echo $random; ?>">
    <br>
    <b>Site URL:</b> <br>
    <input type="text" name="Site">
    <br>
    <b>Contact:</b><br>
    <input type="text" name="Contact">
    <br>
    <b>Company Address:</b> <br>
    <input type="text" name="AddressLine1">
    <br><input type="text" name="AddressLine2">
    <br><input type="text" name="TownCounty">
    <br><input type="text" name="PostCode">
    <br>
    <b>Company Telephone Number:</b> <br>
    <input type="text" name="TelNo">
    <br>
    <b>Invoice email address (Leave blank if the same as contact email address):</b> <br>
    <input type="text" name="InvoiceEmail">
    <br>
    <b>Pay Method:</b> <br>
    <input type="text" name="PayMethod">
    <br>
    <b>Start Date:</b> <br>
    <input type="text" name="StartDate">
    <br>
    <b>End Date:</b> <br>
    <input type="text" name="EndDate">
    <br>
    <b>Banner URL:</b><br>
    <input type="text" name="bannerurl">
    <br><br>
    <input type="submit" name="Submit" value="Submit">
    </center></form>
    <?php
    }
    ?>
    Okay i decided to give up on that one so i did this, i have my form, but when i submit it it sorta jiggles all of the results around into the wrong fields, BTW on their i haven't included my database connect but i do have one :]
    Last edited by Johnnikins; 07-08-2008 at 04:11 PM.

  3. #3
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by Johnnikins View Post
    Code:
    <?php
    if (isset($_REQUEST['Submit'])) {
    # Feudel.co.uk Advertising Manager
    $sql = "INSERT INTO $db_table(RefNum,Site,Contact,AddressLine1,AddressLine2,TownCounty,PostCode,TelNo,InvoiceEmail,PayMethod,StartDate,EndDate,bannerurl) values ('".mysql_real_escape_string(stripslashes($_REQUEST['RefNum']))."','".mysql_real_escape_string(stripslashes($_REQUEST['Site']))."','".mysql_real_escape_string(stripslashes($_REQUEST['Contact']))."','".mysql_real_escape_string(($_REQUEST['bannerurl']))."','".mysql_real_escape_string(($_REQUEST['TelNo']))."','".mysql_real_escape_string(($_REQUEST['InvoiceEmail']))."','".mysql_real_escape_string(($_REQUEST['PayMethod']))."','".mysql_real_escape_string(($_REQUEST['StartDate']))."','".mysql_real_escape_string(($_REQUEST['EndDate']))."','".mysql_real_escape_string(($_REQUEST['AddressLine1']))."','".mysql_real_escape_string(($_REQUEST['AddressLine2']))."','".mysql_real_escape_string(($_REQUEST['TownCounty']))."','".mysql_real_escape_string(($_REQUEST['PostCode']))."')";
    if($result = mysql_query($sql ,$db)) {
    echo '<div class="ocontentsection">
    <div class="contenttext"><table class="gltable" cellpadding="0" cellspacing="0"><center>Thank you<br>Your information has been entered.<br><img src="http://www.feudel.co.uk/arcade/plugins/site/themes/GreyJohnsSkin/header/header_r1_c1.gif"><br><br><a href="http://www.feudel.co.uk/arcade/ads">Return</a>';
    } else {
    echo "ERROR: ".mysql_error();
    }
    } else {
    ?><div class="ocontentsection">
    <div class="contenttext"><table class="gltable" cellpadding="0" cellspacing="0"><center>
    If you have accepted an advertisement, Please enter information here, a reference number will then be generated and all staff will use this number when contacting the buyer of advertisements!</center>
    <form method="post" action="">
    <center>
    <input type="hidden" name="RefNum" value="<?php $random = rand(000000000,999999999); echo $random; ?>">
    <br>
    <b>Site URL:</b> <br>
    <input type="text" name="Site">
    <br>
    <b>Contact:</b><br>
    <input type="text" name="Contact">
    <br>
    <b>Company Address:</b> <br>
    <input type="text" name="AddressLine1">
    <br><input type="text" name="AddressLine2">
    <br><input type="text" name="TownCounty">
    <br><input type="text" name="PostCode">
    <br>
    <b>Company Telephone Number:</b> <br>
    <input type="text" name="TelNo">
    <br>
    <b>Invoice email address (Leave blank if the same as contact email address):</b> <br>
    <input type="text" name="InvoiceEmail">
    <br>
    <b>Pay Method:</b> <br>
    <input type="text" name="PayMethod">
    <br>
    <b>Start Date:</b> <br>
    <input type="text" name="StartDate">
    <br>
    <b>End Date:</b> <br>
    <input type="text" name="EndDate">
    <br>
    <b>Banner URL:</b><br>
    <input type="text" name="bannerurl">
    <br><br>
    <input type="submit" name="Submit" value="Submit">
    </center></form>
    <?php
    }
    ?>
    Okay i decided to give up on that one so i did this, i have my form, but when i submit it it sorta jiggles all of the results around into the wrong fields, BTW on their i haven't included my database connect but i do have one :]

    That would be because the way you're inserting mysql doesn't match up, you're supposed to do:

    INSERT INTO `blah` ( `1`, `2`, `3`, `4` ) VALUES ( '1', '2', '3', '4' )

    what you're doing is:


    INSERT INTO `blah` ( `1`, `2`, `3`, `4` ) VALUES ( '2', '4', '3', '1' )

    may not be to scale


    But yeah, just reorganise your fields, they're going in in the wrong order.


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  4. #4
    Join Date
    Apr 2008
    Posts
    39
    Tokens
    0

    Default

    Thanks for the help :]

Posting Permissions

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