Menu

Presenting Forms within a website

Help
zsierra
2005-10-28
2013-06-03
1 2 > >> (Page 1 of 2)
  • zsierra

    zsierra - 2005-10-28

    I just love phpformgen! and that's because I am not a programmer. 

    Can someone please tell me exactly how to get a form onto an existing website page?  Any sample code would be helpful.

    I have rudimentary HTML skills and no php knowledge. 

     
    • TNTEverett

      TNTEverett - 2005-11-01

      PHP knowledge is not required to add a link to your form on any web page.  Depending on your web page development tool adding a hyperlink to some text is very easy.
      Let me know if I can help you with this. 

       
    • WesWays UK

      WesWays UK - 2005-11-25

      Is it Possable to Embed a form into a web page that is on the same site but a different folder then the installed Programme?
      Thanks in advance Wesley

       
      • TNTEverett

        TNTEverett - 2005-11-25

        I'm afraid your loosing me in your description.  What is it you are trying to do?

         
    • WESLEY WILLIAMS

      WESLEY WILLIAMS - 2005-11-27

      Ok right i need to embed a form onto my contact page i want the form to be visable and usable by the user and also dont want to use a link to do this is there a way this can be done ie something like the embed code.

      you see i have tryed this and everything embeds and works fine but on submit i get an error and it wont email or add to the database?

      is there a way i can achive this useing the embed code

      the error i get on submitting the form is

      Method Not Allowed
      The requested method POST is not allowed for the URL /contact.html.

      --------------------------------------------------------------------------------

      Apache/1.3.33 Server at www.world-of-leisure.co.uk Port 80

      Do you have any idea?

      if i go to the form normally it works Fine?
      Thanks Wesley

       
      • TNTEverett

        TNTEverett - 2005-11-27

        There is no difference between the generated form and placing the form in another page like you have done.  If you have not placed all of the required html from the generated form your new page will not work properly.  You have either left something out, or the page you are pasting the form into has some other code that is preventing the form from working properly.  Without seeing the code I can not tell you why it is not working. 
        Send me a link, or send me the file.

         
    • WESLEY WILLIAMS

      WESLEY WILLIAMS - 2005-11-27

      I have managed to get the form working thank you its at http://world-of-leisure.co.uk/contact.html
      but now it wont send the information to the mysql database you see i wanted the ability to 1 for the form to email and 2 for it to hold it in the database and also so they can view the responces live via the web any ideas?
      And Thanks

       
      • TNTEverett

        TNTEverett - 2005-11-28

        <form enctype='multipart/form-data' action='process.php' method='post' name="support" target="_blank">

        This is the line that calls process.php.  Since there is no path information the file should be at the same level as your html file.  You should know that process.php also calls other files.  You will have to open process.php and find the "include" statements and make sure the paths are accurate. 
        If you need more help, send me your process.php file.

         
    • WESLEY WILLIAMS

      WESLEY WILLIAMS - 2005-11-28

      Please find below my Process.php file and global_inc.php and the admin directory is all in the same folder as my form Thanks Wesley

      <?php
      include("global.inc.php");
      $errors=0;
      $error="The following errors occured while processing your form input.<ul>";
      pt_register('POST','PleaseTellUsYourFullName');
      pt_register('POST','EmailAddress');
      pt_register('POST','ContactPhoneNumber');
      pt_register('POST','WhatProductareyouinterestedIn');
      pt_register('POST','PleaseProvideIfAnythenameofOurSalesAgent');
      pt_register('POST','PleaseGiveFullDetailsofYourProblem');
      $PleaseGiveFullDetailsofYourProblem=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $PleaseGiveFullDetailsofYourProblem);pt_register('POST','PleaseHelpUsByHelpingyouinTellingUshowyoufoundOurSite');
      pt_register('POST','IfOtherPleaseSpecify');
      pt_register('POST','OfficeUseOnlyAdminInformation');
      pt_register('POST','OfficeUseOnlySupportInformation');
      if($PleaseTellUsYourFullName=="" || $EmailAddress=="" || $WhatProductareyouinterestedIn=="" || $PleaseGiveFullDetailsofYourProblem=="" || $PleaseHelpUsByHelpingyouinTellingUshowyoufoundOurSite=="" ){
      $errors=1;
      $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
      }
      if($errors==1) echo $error;
      else{
      $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
      $message="Please Tell Us Your Full Name: ".$PleaseTellUsYourFullName."
      Email Address: ".$EmailAddress."
      Contact Phone Number: ".$ContactPhoneNumber."
      What Product are you interested In: ".$WhatProductareyouinterestedIn."
      Please Provide If Any the name of Our Sales Agent: ".$PleaseProvideIfAnythenameofOurSalesAgent."
      Please Give Full Details of Your Problem: ".$PleaseGiveFullDetailsofYourProblem."
      Please Help Us By Helping you in Telling Us how you found Our Site: ".$PleaseHelpUsByHelpingyouinTellingUshowyoufoundOurSite."
      If Other Please Specify: ".$IfOtherPleaseSpecify."
      Office Use Only Admin Information: ".$OfficeUseOnlyAdminInformation."
      Office Use Only Support Information: ".$OfficeUseOnlySupportInformation."
      ";
      $message = stripslashes($message);
      mail("support@world-of-leisure.co.uk","Form Submitted at your website",$message,"From: world-of-leisure");
      $link = mysql_connect("localhost","MYDBUSERNAME","MYDBPASSWORD");
      mysql_select_db("MYDBNAME",$link);
      $query="insert into support5 (name,email,phone,product,sales_agent,details,found_via,other,office_admin,office_support) values ('".$PleaseTellUsYourFullName."','".$EmailAddress."','".$ContactPhoneNumber."','".$WhatProductareyouinterestedIn."','".$PleaseProvideIfAnythenameofOurSalesAgent."','".$PleaseGiveFullDetailsofYourProblem."','".$PleaseHelpUsByHelpingyouinTellingUshowyoufoundOurSite."','".$IfOtherPleaseSpecify."','".$OfficeUseOnlyAdminInformation."','".$OfficeUseOnlySupportInformation."')";
      mysql_query($query);
      $make=fopen("admin/data.dat","a");
      $to_put="";
      $to_put .= $PleaseTellUsYourFullName."|".$EmailAddress."|".$ContactPhoneNumber."|".$WhatProductareyouinterestedIn."|".$PleaseProvideIfAnythenameofOurSalesAgent."|".$PleaseGiveFullDetailsofYourProblem."|".$PleaseHelpUsByHelpingyouinTellingUshowyoufoundOurSite."|".$IfOtherPleaseSpecify."|".$OfficeUseOnlyAdminInformation."|".$OfficeUseOnlySupportInformation."
      ";
      fwrite($make,$to_put);
      ?>

      <!-- This is the content of the Thank you page, be careful while changing it -->

      <h2>Thank you!</h2>

      <table width=50%>
      <tr><td>Please Tell Us Your Full Name: </td><td> <?php echo $PleaseTellUsYourFullName; ?> </td></tr>
      <tr><td>Email Address: </td><td> <?php echo $EmailAddress; ?> </td></tr>
      <tr><td>Contact Phone Number: </td><td> <?php echo $ContactPhoneNumber; ?> </td></tr>
      <tr><td>What Product are you interested In: </td><td> <?php echo $WhatProductareyouinterestedIn; ?> </td></tr>
      <tr><td>Please Provide If Any the name of Our Sales Agent: </td><td> <?php echo $PleaseProvideIfAnythenameofOurSalesAgent; ?> </td></tr>
      <tr><td>Please Give Full Details of Your Problem: </td><td> <?php echo $PleaseGiveFullDetailsofYourProblem; ?> </td></tr>
      <tr><td>Please Help Us By Helping you in Telling Us how you found Our Site: </td><td> <?php echo $PleaseHelpUsByHelpingyouinTellingUshowyoufoundOurSite; ?> </td></tr>
      <tr><td>If Other Please Specify: </td><td> <?php echo $IfOtherPleaseSpecify; ?> </td></tr>
      <tr><td>Office Use Only Admin Information: </td><td> <?php echo $OfficeUseOnlyAdminInformation; ?> </td></tr>
      <tr><td>Office Use Only Support Information: </td><td> <?php echo $OfficeUseOnlySupportInformation; ?> </td></tr>
      </table>
      <!-- Do not change anything below this line -->

      <?php
      }
      ?>

       
      • TNTEverett

        TNTEverett - 2005-11-28

        Remove this line and let me know if it works.

        $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));

         
    • WESLEY WILLIAMS

      WESLEY WILLIAMS - 2005-11-29

      Yes That Worked good Thanks but i receive emails now but it wont add the information to the database i need to be able to view this info via the web as well as via email? is there anywhere in process.php that specifies where i need to place the correct admin folder because the admin folder is in the main public_html Directory.
      Will this be possable?
      Many thanks Yet again Wesley

       
      • TNTEverett

        TNTEverett - 2005-11-29

        This is the line in the process.php file that defines the path to the data file. 
        $make=fopen("admin/data.dat","a");
        By default the path is relative so that if the admin folder is moved ot the same folder as the form it should work. 
        The folder and file permissions still have to be right for the process.php file to be able to write to this file. 

         
    • WESLEY WILLIAMS

      WESLEY WILLIAMS - 2005-12-03

      Hiya the folder admin is  in the exact same directory with full permissions as the form What am i doing wrong? many thanks Wes

       
    • EmeraldSpark

      EmeraldSpark - 2005-12-03

      I have mine in the cgi-bin of my website, and I set the file permissions CHMOD 755.

      And I loaded it to that through FTP in ASCII mode.

      Don't know if that helps cos I'm no expert it's just what worked for mine.

       
      • TNTEverett

        TNTEverett - 2005-12-03

        This program is in use by many many happy customers including myself.  I'm sure your problem will end up being something very simple in the end. 
        I'm afraid without seeing your whole installation it is very difficult to diagnose all but the most simple problems.  I would be more than happy to test your form on my PC or host if you zip and send me your project. 

         
    • WESLEY WILLIAMS

      WESLEY WILLIAMS - 2005-12-04

      i am more then pleased with the form and Cant Thank you enough for your top support though because of the sensitivaty of the project in quistion is it possable i can contact you via email and then from there give you FULL permission on to the site so as to see if its something i am doing wrong many thanks Wesley and Thank you once again for your help.

       
      • TNTEverett

        TNTEverett - 2005-12-04

        Absolutely.  Send me an email via my SourceForge account name (not a forum post) providing your non-sourceforge email account. 
        Follow this link and send me a message with your non-sourceforge email account.
        https://sourceforge.net/users/tnteveret1/
        I will reply with my non-sourceforge email account. 

         
    • WESLEY WILLIAMS

      WESLEY WILLIAMS - 2005-12-08

      TNTEverett you are a Gentleman and a star Thanks for all your help and assistance with helping me resolve my issue Thanks Again

       
    • Jason Browdy

      Jason Browdy - 2006-02-12

      I have not read the entire post, but I just managed to embed my form into an existing web page.  You just need to make the forms1.html file into a forms1.php file, then change the line that calls for the process.php to make it relative to the page into which you are embedding.  Then go to the original page into which you are embedding and do a php include to call the html from the forms1.php file.  Make sure to remove the head and body tags from the forms1.php file

       
      • TNTEverett

        TNTEverett - 2006-02-13

        You make it so complicated.  The form1.html file is nothing more than a big <form></form> section of HTML.  Cut and paste everything between these two tags into any other HTML file and you will see your form.  No need to convert to php or do any include finctions. 

         
        • webnetincome

          webnetincome - 2007-07-14

          Ok, let me see if I can get some answers from those of you who have had this trouble.  I want to place the form on my own webpage.  I copied and pasted the form1.html file and I have the form now, except for the little arrows (apparently little .gifs etc. and I can find them probably).  

          Anyway form does not send because original form was located at www.mywebsite.com/sendform/use/ContactUs/form1.html

          The new page with the form embedded is of course at different location.

          Do I somehow download the new .html page to the same folder instead of the public_html folder?

          Do I need to change permissions etc.?

          Been reading a while and just ain't finding the right things.  I am just a hair off of it working i think.

          This is the message I get when form is filled out and submitted:

          Not Found
          The requested URL /process.php was not found on this server.

          Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

          Of course the original form worked fine---just doesn't look like my website.

          Thanks

           
          • jsherk

            jsherk - 2007-07-15

            Just copy ALL the files that were in the  http://www.mywebsite.com/sendform/use/ContactUs directory (not just the form1.html file) into the new location and it should work!

             
            • webnetincome

              webnetincome - 2007-07-15

              Sorry, got me a little confused.

              My files are already in public_html

              The folder name is sendform

              I don't understand what I need to do.

              Thanks, I am not good at this stuff.

               
              • jsherk

                jsherk - 2007-07-15

                Alright, I think you are saying that you copied ALL the files over already, and it still isn't working. But you said you were missing the arrows, which means that you may not have copied all the files over from the /use/contactus directory. The error you got also says that it couldn't find the process.php file, so again it looks like you didn't copy everything.
                The files you need to copy over are:
                  bc_new.gif
                  button.jpg
                  form1.html
                  global.inc.php
                  nav_m.gif
                  process.php
                  tile_back.gif
                  tile_sub.gif
                  There is also an admin folder you shoul copy with everyting in it, so you can retrieve data later. (As a side note you should password protect the admin folder).

                ALL these files all need to be in the SAME directory as the form1.html file. Wherever your form1.html form is, that's were the other files need to be also.

                The form1.html can stay in your public_html folder, but all the other files also need to be the public_html folder as well.

                I think you also mentioned that you put the form1.html into another file(copied/pasted/edited)? So you need to double check that everything in the form1.html file was copied and pasted correctly into whatever the new form was. You could put the original form1.html file (with NO modifications)into the public_html folder with all the other files, and see if it works correctly.

                I may not have email access for a couple of days, but I'll keep checking up on you to see how it's going

                 
    • Jason Browdy

      Jason Browdy - 2006-02-13

      Wow.  You are correct.  I actually tried this method before, but I must have included the head, body, htlm tags or something by accident.  You still have to change the path to the process.php file if it's not in the same directory of your html page.  But, you are totally correct.  Seems to load faster, too.  Thanks.

       
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.