93 users online (0 members and 93 guests)  

Thread: cgi confusion


Page 1 of 2 1 2 Last
  Results 1 to 15 of 28

Related

  1. Coding Confusion    Forum: PHP Forum
    Replies: 5
  1. #1
    Carolynne's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Shingle Springs, CA
    Posts
    11

    Question cgi confusion

    I am trying to ad a form to my website and have the results sent to my email address. I have researched fr*e cgi scripts on the web, downloaded and tried a few, but I can't seem to make them work. I emailed my hosting company and they said they can't help me. I have done this once before, but it was two years ago, so I don't remember what I did to make it work.

    Please help! I am not a programmer

    Thanks

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    First, you have to make sure CGI is enabled on your hosting account. You host should be able to help you with that.

    Secondly, most cgi scripts need to be in a directory called cgi-bin to run, and they need persmissions set to executable.

    Do you get any errors when you run it?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    Carolynne's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Shingle Springs, CA
    Posts
    11

    cgi confusion

    Hi QuietDean,

    Thanks for your reply. You'll have to bear with me because I really am a novice at this. I do not know what to do to enable CGI, but I will contact my hosting company to see if they can help me with that.

    I did put the script in the cgi-bin directory, but I am not sure I have made the proper revisions to the script and and added the corresponding HTML code correctly to my form page.

    As far as errors...when I click "Submit" on the form it routes me to this address:

    htpp://www.pixelgraphixdesign.com/cgi-bin/nether-mail.pl.

    That is the script I am attempting to use. Of course it says page can not be displayed.

    Do you need to see my code for my HTML page and the CGI script?

    I think there are several things I am probably doing wrong!

  4. #4
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    change htpp to http

  5. #5
    Carolynne's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Shingle Springs, CA
    Posts
    11

    Talking I wish it was that easy...

    Hi Dave,

    Thanks for the tip. I wish the fix was as simple as changing a letter! I feel like an idiot for not catching that, it was 1 AM at the time I typed that...that's my story and I'm sticking to it

    Anyway I contacted my hosting company and they said that they do not support CGI mail scripts and they recommend using the Jmail component. Do you know anything about this? I am going to investigate. I hope it's not too confusing...

    30 minutes later...

    Well, it's confusing (to me anyway). I have the ASP source code for Jmail, but I don't know how that will connect to my form. I'm not really sure what to do with this script either to make it work with my form.

    I just don't know how it can be this difficult. There are forms everywhere on the web and I know not everyone is a programming genius. HELP!


    Carolynne
    Last edited by Carolynne; 08-17-2003 at 12:57 PM.

  6. #6
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    I am not personally familiar with jmail, ASP also rules me out , there are other who are pretty goood with ASP so be patient and I am sure you will get some help.

    Dave

  7. #7
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Jmail (and your host) should come with some documents, FAQ's etc. We should start with those.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  8. #8
    Carolynne's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Shingle Springs, CA
    Posts
    11

    Jmail scrip

    Hi QuietDean,

    Here is the script that I got from my hosting company.

    <%

    'First, initialize the JMail program...

    Set JMail = Server.CreateObject("JMail.Message")

    'Next, define your SMTP server & port address...

    '(note that you just need to use the following line

    JMail.ISOEncodeHeaders = False

    'This Entries is required to send email using Advanced Mail Services

    'JMail.MailServerUserName = "email removed" ' UserName of a Valid Advanced POP Account
    'JMail.MailServerPassword = "MyPassword" ' Password or a Valid Advanced POP Account

    'The JMail Sender property is what you set to let your recipient

    'know who the e-mail is from, for example...

    JMail.From = "email removed"

    'The Subject property allows you to fill in the subject of the

    'e-mail message you're sending...

    JMail.Subject = "This is a Test of JMail"

    'To add recipients to the e-mail message, you use the AddRecipient

    'method. Note that it does not require the use of an = sign!

    JMail.AddRecipient Request.Form("Email")

    'You can keep adding recipients until you're done...

    'JMail.AddRecipient "email removed"

    'JMail.AddRecipient "email removed"
    ' Get the recipients mailbox from a form (note the lack of an equal sign).

    'JMail.AddRecipient Request.Form("Email")

    'You can also add recipients to what would normally be the CC:

    'and BCC: fields of your e-mail, as follows (respectively)...

    'JMail.AddRecipientCC "email removed"

    'JMail.AddRecipientBCC "email removed"

    'If you want to make the To: address more personal, you can

    'use the AddRecipientEx method to add not only the person's

    'e-mail address, but their name, too...

    'JMail.AddRecipientEx "email removed", "Sparky O'Malley"

    'The body of your message can be set in a number of ways. To

    'set the body explicitly, you can just do something like this...

    JMail.Body = "This is a test Email from a J-Mail Script."

    'Or you might need to add text later after a generic greeting,

    'in which case you'd append text to the body like this...

    JMail.Body = JMail.Body & " Have a nice day!"

    'You can also append text with the AppendText method...again,

    'note the lack of an = sign here because you're using a method,

    'not setting a property

    'JMail.AppendText "Have a nice day!"

    'If you have some text stored in a file, you can also use the

    'contents of that file to set the body of the message, as

    'follows...

    'JMail.AppendBodyFromFile "c:\webserver\yourdomain\htdocs\mytext.txt"

    'If your message is really important, you may want to set the

    'message priority with the Priority property. When setting this

    'property, remember that 1 is highest priority (urgent) and

    '5 is lowest priority...

    JMail.Priority = 1

    'You can even add attachments to your message. As with the

    'AddRecipient method, this does not use = signs and can be called

    'as many times as you have attachments...

    'JMail.AddAttachment "c:\webserver\yourdomain\htdocs\pix\myphoto.jpg"

    'JMail.AddAttachment "c:\webserver\yourdomain\htdocs\faq\faq1.txt"

    'Once you've set everything up, it's just a matter of sending the

    'message...

    JMail.Send(Request.Form("SMTP"))

    %>


    This did not help me...so I kept looking and found another Jmail script. Here is the code for that.

    <html>

    <head>
    <title>JMAIL Script Courtesy of Win-Hosting.co.uk</title>
    </head>
    <body>
    <p align="center"><font face="Arial, geneva" size="5"> Email Form</font></p>
    <%
    Name = Request.Form("name")
    SenderEmail = Request.Form("email")
    Subject = "Regarding " & Request.Form("subject")
    Recipient = Request.Form("recipient")
    Body = Request.Form("body")

    Set JMail = Server.CreateObject("JMail.SMTPMail")

    ' Below you should enter your own SMTP-server
    JMail.ServerAddress = "smtp.yourmailserver.com"

    JMail.Sender = Senderemail
    JMail.Subject = Subject

    JMail.AddRecipient Recipient

    JMail.Body = Body

    JMail.Priority = 3

    JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
    JMail.Logging = True
    JMail.Execute

    %>
    <center>
    <font face="Arial, geneva" size="3"> Your email has been sent to <%= Recipient %><br>
    </font>
    </center>
    </body>
    </html>

    This one makes more sense to me and came with better instructions and a sample form. However, I am not sure which one is better or if they both work the same.

    I found the second script at www.win-hosting.co.uk/a1scriptsjmail.asp

    Thanks for taking the time to look at this stuff!

  9. #9
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    If I was you, I would use the one you are more comfortable with, and just try it. Read thru the docs, setup the script following the good example, and try it.

    Then post back any problems.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  10. #10
    Carolynne's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Shingle Springs, CA
    Posts
    11

    Unhappy I tried

    I tried to revise the script according to the instructions, but to no avail. The thing still isn't working. Even though these instructions are more understandable than the script I got from my hosting company, I feel like they are geared toward someone who already understands this programming language. Alas, I do not. I am more of a designer than a programmer.

    Also, I am not sure into which directory I should put the asp script, so I am sure I have it in the wrong place.

    I am bummed. I really want this thing to work.

    Please help!

  11. #11
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    ASP script can go whereever you like.

    Could you describe 'its not working' for us? If you give us theprocess we may be able to spot whats wrong.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  12. #12
    Carolynne's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Shingle Springs, CA
    Posts
    11

    not working

    I uploaded my ASP script into the same directory as the form html file. I tried to alter the code according to the instructions and also tried to figure out what I needed to do to make it work with my form. I am not sure if I was doing that right though, because the instructions were sketchy in that department.

    Basically, when I use the submit button on my form, nothing happens. I don't get an email and it doesn't redirect the user to the specified page.

  13. #13
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Could you link to the form page, and post the code to your asp page?(without your smtp password!)

    Should help at this stage
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  14. #14
    Carolynne's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Shingle Springs, CA
    Posts
    11
    Here is the link to my page:

    http://www.pixelgraphixdesign.com/hheaven/woody_pet_pro/ca-form.html

    and here is my code...(don't laugh)

    <html>

    <head>
    <title>Thank You</title>
    </head>
    <body>
    <p align="center"><p>&nbsp;</p><p>&nbsp;</p><p align="center">
    <font face="Verdana, "Trebuchet MS", Arial, sans-serif" size="2">Your information has been sumbitted.</font></p>
    <%
    FirstName = Request.Form("FirstName")
    LastName = Request.Form("FirstName")
    City = Request.Form("City")
    State = Request.Form("State")
    Phone = Request.Form("Phone")
    SenderEmail = Request.Form("email")
    bagged_shavings = Request.Form("bagged_shavings")
    BaggedShavingsPrice = Request.Form("BaggedShavingsPrice")
    bulk_shavings = Request.Form("BulkShavingsPrice")
    straw = Request.Form("straw")
    StrawPrice = Request.Form("StrawPrice")
    rice_hulls = Request.Form("rice_hulls")
    RiceHullsPrice = Request.Form("RiceHullsPrice")
    other = Request.Form("other")FirstName = Request.Form("FirstName")
    OtherBedding = Request.Form("OtherBedding")
    OtherPrice = Request.Form("OtherPrice")
    StallCount = Request.Form("StallCount")
    BeddingPerWeek = Request.Form("BeddingPerWeek")
    textfield = Request.Form("textfield")


    Set JMail = Server.CreateObject("JMail.SMTPMail")

    ' Below you should enter your own SMTP-server
    JMail.ServerAddress = "probably putting in the wrong address"

    JMail.Sender = Senderemail
    JMail.Subject = Subject

    JMail.AddRecipient "email removed"

    JMail.Body = Body

    JMail.Priority = 1

    JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
    JMail.Logging = True
    JMail.Execute

    %>
    <center>
    <font face="Verdana, "Trebuchet MS", Arial, sans-serif" size="2"><b>Thank You.</b><p>
    <a href="hheaven/woody_pet_pro/cost.html">Return to cost analyisis.</a>
    </font>
    </center>
    </body>
    </html>

    Thanks!

  15. #15
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Code:
    Microsoft VBScript compilation error '800a0401' 
    
    Expected end of statement 
    
    /hheaven/woody_pet_pro/sendmail.asp, line 23 
    
    other = Request.Form("other")FirstName = Request.Form("FirstName")
    -----------------------------^
    That line should have a newline after the ("other") , change that and try again.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Page 1 of 2 1 2 Last

Tags for this Thread