PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
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)
[syntax="asp"]<% 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!!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Here is a more or less literal translation.. Up to you to lookup the missing bits (make sure to consult the http://www.php.net/docs if you have any doubts about the syntax etc...)
// test if the parameter 'ls' exists in the query parameters
if (array_key_exists('ls', $_GET))
{
// test if the parameter ls matches contact
if ($_GET['ls'] == "contact") {
?>
<p>Thank you for your interest ..... response info number one.</p>
<?php
}
// and so on...
}
<?php
if (isset($_GET['ls']))
{
$ls = $_GET['ls'];
switch($ls)
{
case 'contact':
echo '<p>Thank you for your interest ..... response info number one.</p>';
break;
case 'signup':
echo '<p>Thank you for your interest ..... response info number two.</p>';
break;
case 'jobs':
echo '<p>Thank you for your interest ..... response info number three.</p>';
break;
default:
echo '<p>Please make a selection.</p>';
break;
}
}
?>
<?php
if (isset($_GET['ls']))
{
$ls = $_GET['ls'];
if ($ls == 'contact')
{
echo '<p>Thank you for your interest ..... response info number one.</p>';
}
elseif ($ls == 'signup')
{
echo '<p>Thank you for your interest ..... response info number two.</p>';
}
elseif ($ls == 'jobs')
{
echo '<p>Thank you for your interest ..... response info number three.</p>';
}
}
?>