StroiX Posted April 12, 2008 Share Posted April 12, 2008 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 https://forums.phpfreaks.com/topic/100846-solved-form-issue-please-help/ Share on other sites More sharing options...
Northern Flame Posted April 12, 2008 Share Posted April 12, 2008 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 https://forums.phpfreaks.com/topic/100846-solved-form-issue-please-help/#findComment-515750 Share on other sites More sharing options...
StroiX Posted April 13, 2008 Author Share Posted April 13, 2008 That is exactly what I needed. Thank you for the example. =) Link to comment https://forums.phpfreaks.com/topic/100846-solved-form-issue-please-help/#findComment-515786 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.