Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP form (values disappearing, dont know how it is being processed)
    primarykey
    data
    text
    <p>I'm a complete newbee in php (started just last week)</p> <p>Issue is like this:</p> <p>Basically, I was trying to ensure that once a sub-form is filled, then it is not altered. So, I used !isset to display the sub-form (i.e. if !isset is true) and if !isset is false, then it hides that sub-form and shows the next sub-form (the individuals form has only been designed).</p> <pre><code> &lt;?php include($_SERVER['DOCUMENT_ROOT'].'/officespace/includes/functions.php'); echo'&lt;html&gt; &lt;head&gt; &lt;title&gt; Create &lt;/title&gt; &lt;/head&gt; &lt;body&gt;'; if(!isset($_POST["Category"])){ /* if no category is selected, then this code will display the form to select the category*/ Echo "Pls Select Category before clicking on Submit Category"; /* Breaking out of PHP here, to make the form sticky by using a php code inside form action*/ ?&gt; &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post"&gt; &lt;fieldset&gt; &lt;legend&gt;Select the Category of Person: &lt;/legend&gt;&lt;br /&gt; &lt;input type="radio" name="Category" value="Individual" /&gt; Individual&lt;br /&gt;&lt;br /&gt; &lt;input type="radio" name="Category" value="Company, Pvt Ltd" /&gt; Company, Pvt Ltd&lt;br /&gt;&lt;br /&gt; &lt;input type="radio" name="Category" value="Company, Ltd" /&gt; Company, Ltd&lt;br /&gt;&lt;br /&gt; &lt;input type="radio" name="Category" value="Partnership Firm" /&gt; Partnership Firm&lt;br /&gt;&lt;br /&gt; &lt;input type="radio" name="Category" value="LLP Firm" /&gt; LLP Firm&lt;br /&gt;&lt;br /&gt; &lt;input type="radio" name="Category" value="HUF" /&gt; HUF&lt;br /&gt;&lt;br /&gt; &lt;input type="submit" name='Submit Category' value="Submit Category" /&gt;&lt;br /&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;?php } Else { $Category = $_POST["Category"]; Echo "$Category"; Echo "&lt;br /&gt;"; /* Using swich statement to test the value of Category, and accordingly echo appropriate forms*/ switch ($Category) { case "Individual": if(!isset($_POST['Submit_Data_for_Individual'])){ //if no data for individual is submitted, //then this code will display the form to enter and submit data for Individual Echo /*displays message*/ "Pls Enter the Data for the Individual"; ?&gt; &lt;form action="&lt;?php Echo $_SERVER['PHP_SELF']; ?&gt;" method="post"&gt; &lt;fieldset&gt; &lt;br /&gt; First Namee: &lt;input type="text" name="Individual_First_Name" /&gt; &lt;br /&gt; Middle Name: &lt;input type="text" name="Individual_Middle_Name" /&gt; &lt;br /&gt; Last Name: &lt;input type="text" name="Individual_Last_Name" /&gt; &lt;br /&gt; Date of Birth: &lt;input type="text" name="date_of_birth/incorporation" /&gt; &lt;br /&gt; Gender: &lt;br /&gt; &lt;input type="radio" name="Gender" value="male" /&gt; Male &lt;br /&gt; &lt;input type="radio" name="Gender" value="female" /&gt; Female &lt;br /&gt; Email 1: &lt;input type="text" name="email_1" /&gt; &lt;br /&gt; &lt;input type="submit" name="Submit_Data_for_Individual" value="Submit Data for Individual" /&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;?php }Else { $email_1 = $_POST["email_1"]; $Gender = $_POST["Gender"]; validate_email($email_1); // this is a custom function which i made Echo $Gender; // just to see if value has been passes. problem lies here because its not showing anything // run other validations here // and if all valid then run mysqli insert query for individuals record } break; case "Company, Pvt Ltd": echo "Company, Pvt Ltd"; break; case "Company, Ltd": echo "Company, Ltd"; break; case "Company, Ltd": echo "Company, Ltd"; break; case "Partnership Firm": echo "Partnership Firm"; break; case "LLP Firm": echo "LLP Firm"; break; case "HUF": echo "HUF"; break; case NULL: echo "Error: nothing selected"; break; } } echo '&lt;/body&gt; &lt;/html&gt;'; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload