deansp2001 Posted May 23, 2007 Share Posted May 23, 2007 Hi Im not sure if im posting in the right area, I have a slight problem with a page I am trying to make. Its is a web form for users to enter infomation to register for attending a free event, simple so far. At the end of the form is a question to ask if they require anybody else to attend the event. If the user clicks no, then all they need to do is click submit and there info is sent off and they receive a confirmation email. If the user clicks yes, another part of the form appears asking them for the next persons details and advising them that it will cost £50 for this additional person to attend. Once the user enters these details they will also need to be sent an confirmation email, but also when they click submit they need to be taken to another page to enter there credit card details (which will be sent to NoChex or similiar system). So basicilly I need to know how to code a form that carries out to functions with the hit of 1 button, depending on the information they entered, I dont know if this is possible, but any ideas or thoughts would be great. Thnk you Quote Link to comment https://forums.phpfreaks.com/topic/52638-interactive-forms-with-payment-method/ Share on other sites More sharing options...
radar Posted May 23, 2007 Share Posted May 23, 2007 Perhaps use a switch statement inside your PHP... so it would be something like this.. #1 name your buttons "action". #2 put in something for the value, such as "yes" and "no" #3: some basic php code <?php switch ($action) { default: // show the actual form... the original one that you have now.. break; case no: // enter into database, and send conf email break; case yes: // enter data into the database and get the id# and place it into a cookie(or session) // show the 2nd form, and alert that it will be 50 dollars to have this person attend. break; case submit: // this is the submit button for the 2nd form // use the id number we got before, and update with the 2nd person information break; } ?> That is a real rough version and of course i gave no real programming but that would be how I would do it, and then to keep your HTML and logic seperate, just include the forms instead of programming them in... so program them on 2 different files instead of inside the index.php or wherever you are at. Quote Link to comment https://forums.phpfreaks.com/topic/52638-interactive-forms-with-payment-method/#findComment-259797 Share on other sites More sharing options...
deansp2001 Posted May 23, 2007 Author Share Posted May 23, 2007 Thanks for the advice Radar. Sorry I should of mentioned from the start that I am still very much learning PHP, would you know of any tutorials on this or a similar subject as im not too sure on how to implement the code that you have put below, to be honest im totally lost! My experience at the moment consists of simple html forms with a php page that emails the webmaster and sends a confirmation email to the user. Thanks everyone! Quote Link to comment https://forums.phpfreaks.com/topic/52638-interactive-forms-with-payment-method/#findComment-259865 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.