Jump to content

[SOLVED] FORM issue, please help...


StroiX

Recommended Posts

 

Please take a look at http://www.drychalk.com/_/ur/combined.php, here I have the live example of the issue I am having.

 

I would like the "Personal Information" and "Work Information" choice to disappear but have not been successful at this.  I hope that someone can help me figure this out.  If possible, please also take a look at the whole thing to make sure if I am doing this the proper way by (ex. using heredoc, etc...)  Thank you for your time and support.

 

<html>
<head>
<title>Form</title>
</head>
<body>

<form id="form1" name="form1" method="post" action="<? $PHP_SELF ?>">
  <p>
    <input type="radio" name="group1" value="personal">
    Personal Information
    <br>
  <input type="radio" name="group1" value="work" checked>
  Work Information</p>
  <p>
    <label>
    <input type="submit" name="submit" id="submit" value="continue..." />
    </label>
    <br>
    </p>
</form>

<?php

$group1 = $_POST['group1'];

if ($group1 == "personal"){

print<<<HERE

   <form id="form1" name="form1" method="post" action="process.php">
     <p><strong>Personal Information</strong></p>
     <p>Full Name: 
       <label>
   
       <input type="text" name="name" id="name" />
       </label>
     </p>
     <p>Cell Phone: 
       <label>
       <input type="text" name="cellphone" id="cellphone" />
       </label>
     </p>
  
HERE;

} else if ($group1 == "work") {

print<<<HERE

<form id="form1" name="form1" method="post" action="process.php">
<p><strong> Work Information</strong></p>
<p>Company Name: 
<label>
<input type="text" name="company" id="company" />
</label>
</p>

<p>Work Phone: 
<label>

<input type="text" name="workphone" id="workphone" />
</label>
</p>
HERE;
}


print<<<HERE

<hr />
<p><strong>Other Information</strong></p>
<p>Your message:</p>
<p>
<label>

<textarea name="message" id="message" cols="45" rows="5"></textarea>
</label>
</p>
<p> </p>
<p>
<label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label>
</p>

HERE;
?>
</form>
</body>
</html>

Link to comment
Share on other sites

you mean like this?:

 

<html>
<head>
<title>Form</title>
</head>
<body>

<?php

if(!isset($_POST['submit'])){
?>
<form id="form1" name="form1" method="post" action="<? $PHP_SELF ?>">
  <p>
    <input type="radio" name="group1" value="personal">
    Personal Information
    <br>
  <input type="radio" name="group1" value="work" checked>
  Work Information</p>
  <p>
    <label>
    <input type="submit" name="submit" id="submit" value="continue..." />
    </label>
    <br>
    </p>
</form>

<?php
} else{

$group1 = $_POST['group1'];

if ($group1 == "personal"){

print<<<HERE

   <form id="form1" name="form1" method="post" action="process.php">
     <p><strong>Personal Information</strong></p>
     <p>Full Name: 
       <label>
   
       <input type="text" name="name" id="name" />
       </label>
     </p>
     <p>Cell Phone: 
       <label>
       <input type="text" name="cellphone" id="cellphone" />
       </label>
     </p>
  
HERE;

} else if ($group1 == "work") {

print<<<HERE

<form id="form1" name="form1" method="post" action="process.php">
<p><strong> Work Information</strong></p>
<p>Company Name: 
<label>
<input type="text" name="company" id="company" />
</label>
</p>

<p>Work Phone: 
<label>

<input type="text" name="workphone" id="workphone" />
</label>
</p>
HERE;
}


print<<<HERE

<hr />
<p><strong>Other Information</strong></p>
<p>Your message:</p>
<p>
<label>

<textarea name="message" id="message" cols="45" rows="5"></textarea>
</label>
</p>
<p> </p>
<p>
<label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label>
</p>

HERE;
}
?>
</form>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.