redarrow Posted May 30, 2008 Share Posted May 30, 2008 advance thank you... i am creating a dynamic form where the from will be four form's created with a switch and using a array... i am getting a strang error with the switch the error points to the break; statement <<<< current error >>>>>>> Fatal error: Cannot break/continue 1 level in <<<<<<<, please help cheers.... <?php $form=array("<textarea name='note' rows='20' cols='40'> </textarea>", "<input type='submit' name='submit' value='SUBMIT ENQUIRE'>", "<input type='hidden' name='enquire_type' value='$enquire_type'>", "<input type='text' name='name'>", "<input type='text' name='telphone'>", "<input type='text' name='email'>"); if($_POST['submit']){ $enquire_type=$_POST['enquire_type']; switch ($enquire_type){ case General_enquire; echo"<form method='POST' action=' '> <br> <font color='red'>This is a $enquire_type!</font> ".$form[2]." <br><br> Name! <br> ".$form[3]." <br><br> Email! <br> ".$form[4]." <br><br> Tel Number! <br> ".$form[5]." <br><br> State your enquire! <br> ".$form[0]." <br><br> ".$form[1]." </form>"; exit; } break; } ?> <form method="POST" action ""> <br><br> Please provide enquire type! <br><br> <select name="enquire_type"> <option value="General_enquire">General Enquire</option> <option value="Computer_repairs">Computer Repairs</option> <option value="Flat_pack_enquire">Flat Pack Enquire</option> <option value="Audio_installation">Audio Installation</option> </select> <input type="submit" name="submit" value="SEND"> </form> Link to comment https://forums.phpfreaks.com/topic/107918-php-dynamic-form-please-help/ Share on other sites More sharing options...
redarrow Posted May 30, 2008 Author Share Posted May 30, 2008 if you delete the breake statement from the switch it works but that wrong.......... also tried it without the exit; statement but brake wont work very wiered........ Link to comment https://forums.phpfreaks.com/topic/107918-php-dynamic-form-please-help/#findComment-553196 Share on other sites More sharing options...
redarrow Posted May 30, 2008 Author Share Posted May 30, 2008 code corrected ......... now i need to inplement the other 3 forms dynamickly.......... <b>Computer Maintenance - Audio Visual Installation</b> <?php $form=array("<textarea name='note' rows='20' cols='40'> </textarea>", "<input type='submit' name='submit' value='SUBMIT ENQUIRE'>", "<input type='hidden' name='enquire_type' value='$enquire_type'>", "<input type='text' name='name'>", "<input type='text' name='telphone'>", "<input type='text' name='email'>"); if($_POST['submit']){ $enquire_type=$_POST['enquire_type']; switch ($enquire_type){ case General_enquire; echo"<form method='POST' action=' '> <br> <font color='red'>This is a $enquire_type!</font> ".$form[2]." <br><br> Name! <br> ".$form[3]." <br><br> Email! <br> ".$form[4]." <br><br> Tel Number! <br> ".$form[5]." <br><br> State your enquire! <br> ".$form[0]." <br><br> ".$form[1]." </form>"; exit; break; } } ?> <form method="POST" action ""> <br><br> Please provide enquire type! <br><br> <select name="enquire_type"> <option value="General_enquire">General Enquire</option> <option value="Computer_repairs">Computer Repairs</option> <option value="Flat_pack_enquire">Flat Pack Enquire</option> <option value="Audio_installation">Audio Installation</option> </select> <input type="submit" name="submit" value="SEND"> </form> Link to comment https://forums.phpfreaks.com/topic/107918-php-dynamic-form-please-help/#findComment-553203 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.