Hi all. I’m new to php and am having a problem getting $_POST Function / switch () to work. I am coding a registration form. I ask the user a Yes/No question. Depending on the answer I have an Include () bring in the coding for the next step of the registration process, which also has a Yes/No question. I am using submit buttons for the user to give me the answers.
The first $_POST Function / switch () works and will include () the proper coding. The second $_POST Function / switch () does not work.
Both are essentially the same coding with just the variable name changed.
This is the coding used:
<form action="register.php" method="post" name="regForm" id="regForm">
//
HTML in between, input user first name / last name
//
(This works)
// Asking if user is a real estate agent
<?php
$agent = " ";
if (!isset($_POST['agent']))
{
//If not isset -> set with dummy value
$_POST['agent'] = " ";
}
?>
<table align = "center" border="5" cellpadding="3" cellspacing="0">
<col width="430" >
<tr align = "center">
<td>
Are you a licensed Florida real estate agent?
// This is the submit buttons
<input type="submit" name="agent" value="No">
<input type="submit" name="agent" value="Yes">
</td>
</tr>
</table>
// Yes / No switch
<?php
$agent = $_POST['agent'];
switch( $agent ) {
case 'No':
include ("register_3.php");
break;
case 'Yes':
include ("register_2.php");
break;
}
?>
Once the above Yes/No is executed it brings in:
(This does not work)
// Asking if user want to sign up for foreclosure list
<?php
$forlst = " ";
if (!isset($_POST['forlst']))
{
//If not isset -> set with dummy value
$_POST['forlst'] = " ";
}
?>
<table align = "center" border="5" cellpadding="3" cellspacing="0">
<col width="430" >
<tr align = "center">
<td>
Would you like to receive our weekly foreclosure list (by email)
//This is the submit buttons
<input type="submit" name="forlst" value="No">
<input type="submit" name="forlst" value="Yes">
</td>
</tr>
</table>
// Yes / No switch
<?php
$forlst = $_POST['forlst'];
switch( $forlst ) {
case 'No':
include ("register_4.php");
break;
case 'Yes':
include ("register_4.php");
break;
}
?>
What am I doing wrong? Do I need to some how clear the POST before I use the function again? If so, how do I do it?
why aint this working?
i have this code:Code: $num = 250; $count = ($num - $rcount); echo $rcount; echo ""; echo $count;when i echo $rcount it gives me 153...so my calculations is 250-153 = 97.but
upload form file types....
Hey all, I am learning PHP and I am writing a script from the W3C Schools tutorials for uploading files to my server. I want to be able to use it for a friend to upload files to my server (I know to
uploading video files into mysql in php
hi,I have the video files which i have to upload into mysql db. along with creating thumbnails from the video.can any one help me in this which will be greatful to methank u
Drawing Images in classes
I'm quite new to Object Oriented PHP. What I'm trying to do is draw some images but also have other content on the page.Code: include('images.php');//New Image set$im=new images();//Sends headers and
Display a default image
Setting/Modify Headers using mail() function
I have a question about setting email headers when using mail() in a php script.When I send an email from an email account set up domain (using, for example, xxx@MyDomain.net) and then view the header
division gives infinity anser
int main(){ int z=0; int i=1/z; cout<<i;}It doesn't throw any error in Visual Studio 2008. .......What setting one has to change so that it will show runtime error in VS 2008.....
Using Curl_multi for processing multiple URLs
Hi,I am at a loss as to how to implement this. I would like to be able to automatically assign a number of urls taken from a file to x amount of curl_multi handles determined by the user on the form,
Sending CC Info by email
I am a little bit less knowledgable in the security area as most developers and I know I have a lot to learn so maybe this is a start. But I have a client who just came over to us and previously was
whats wrong with my code please help!!!
this is the errorWarning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /var/www/IpSearch.php on line Code: [Select]<?php$srch = $_REQUEST["srch"];if