www.webdeveloper.com
Results 1 to 9 of 9

Thread: asp to php conversion - form handling

  1. #1

    Exclamation asp to php conversion - form handling

    I'm fairly green in the exciting world of PHP ... I've been trying to convert this ASP code to PHP ... basically I have a "thankyou.php" page that requires 3 different responses depending on which form is submitted. Below is the "current" ASP variation and I'm in hopes of finding a solution / expertise to make it PHP-able! (3 different forms throughout site feed into this "thankyou.php" form/response page)

    <% if request.querystring("ls")="contact" then%>
    <p>Thank you for your interest ..... response info number one.</p>
    <% elseif request.querystring("ls")="signup" then%>
    <p>Thank you for your interest ..... response info number two.</p>
    <% elseif request.querystring("ls")="jobs" then%>
    <p>Thank you for your interest ..... response info number three.</p>
    <% end if%>


    I appreciate all and any thoughts/help you may have and please remember I'm eagerly learning the ropes--with that--IF anyone has recommendations to PHP learning via DVD--I'm all ears!!

    Thanks again!
    Des

  2. #2
    Join Date
    Nov 2006
    Posts
    73
    This is what it would have to look like in php:

    PHP Code:
    <?PHP
    if ($_GET['ls']=="contact")
    {
       echo
    "<p>Thank you for your interest ..... response info number one.</p>";
    }
    elseif(
    $_GET['ls']=="signup")
    {
       echo
    "<p>Thank you for your interest ..... response info number two.</p>";
    }
    elseif( 
    $_GET['ls']=="jobs" )
    {
       echo
    "<p>Thank you for your interest ..... response info number three.</p>";
    }
    ?>
    If you used the Post method in you form it has to be $_POST['ls'] instead of $_GET['ls']!

    I'm sorry but I don't know any DVD courses in English ...
    Last edited by MatMel; 02-12-2007 at 10:24 AM.

  3. #3
    MatMel,

    I attempted insterting the code you suggested, but the "response" comes up blank ... Do you have any thoughts?

    Thanks again for any help you can provide!!

    Des

  4. #4
    Join Date
    Nov 2006
    Posts
    73
    Did you install the php plugin on your server?
    Does the file have the extension ".php"?
    Did you use the right submiting method (get / post) ?

  5. #5
    MatMel,

    This file as well as many others are all php extensions and have tested "properly" ... I've even swapped ou the get to "POST" and still come up with the same issue.

    Thoughts?

    Des

  6. #6
    Join Date
    Nov 2006
    Posts
    73
    I just tested it on my server:

    /test12.php?ls=contact
    gives me the output
    "Thank you for your interest ..... response info number one."

  7. #7
    okay ... so is there something I'm missing? BTW, this is hosted on Network Solutions who currently don't have php 5 up yet ...

    do you have suggestions?

  8. #8
    Join Date
    Nov 2006
    Posts
    73
    An older php version is not the problem ...
    The if statements are avaiable in every version.

    Did you try a new file wich only contains the bit of code I posted?
    Do you send the value of "ls" by a form or manually in the url (eg ?ls=contact) ?

  9. #9
    MatMel,

    It seems to work just great ... I reversed back to "GET" via "POST" and it worked fine. I'm still new at this and I thank you for your patience!!!

    Des

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles