spiderwell Posted April 19, 2011 Share Posted April 19, 2011 do this first, get the hidden field working, it shouldnt be too hard. then get the process form (sendinfo2.php) to pull out the users name, and then open the text file and read it line by line, each time checking if the line has the username in it. next part will be taking that line from text file, explode the data into an array (note that the delimiter is a semi colon on the subscriptions, but first remove the username and tab or that will screw things up. then you need to compare form sumbitted subscriptions to textfile subscriptions list. Quote Link to comment https://forums.phpfreaks.com/topic/233404-help-with-an-assignment/page/2/#findComment-1203541 Share on other sites More sharing options...
spiderwell Posted April 19, 2011 Share Posted April 19, 2011 form A> input users name. POSTS to form B (info.php)> select subscriptions, include form A data in hidden field POSTS to info2.php> opens text file already on server and compares form input matches text file info Quote Link to comment https://forums.phpfreaks.com/topic/233404-help-with-an-assignment/page/2/#findComment-1203542 Share on other sites More sharing options...
stepo Posted April 19, 2011 Author Share Posted April 19, 2011 Ok, let me get this right. You have a Form.. FormA which POSTs to info.php info.php displays a list of stuff dependent upon a text file and the username? and sendinfo2.php .... adds to the text file? Maybe it's the excess of forms, but I'm slightly confused. What exactly is wrong? You are nearly right, the info.php is just a list of the different categories. Banks, contrsuction, aeroplanes etc. When the user clicks on submit it will connect with sendinfo2.php to do the checking in the txt file to see if that user name has a subscription. if the user does have a subscription it will come back with the information of the certain category they have subscribed to. So if it was banks. there is a txt file that would open on the page with the info. but for this example we have been given the banks.txt file just contains info like this is about banks.... Yea spiderwell has got it spot on. This is the code I have.. For sign2.html <HTML> <HEAD> <TITLE>Stock Market</TITLE> </HEAD> <BODY> <H1>Stock Market Sign-in Form</H1><HR> Welcome, customer!<P> <form action ="info.php" method="post"> Enter your name: <input type="text" name="CodeField"> <input type="submit" VALUE="Submit"> </form> </BODY> </HTML> For info.php <head> <title>Stock Market</title> </head> <body> <h1> Please select which area of the stock market interest you</h1> <form name="form1" method="post" action="sendinfo2.php"> <p> <label> <input type="radio" name="stockinfo" value="Aviation and Aerospace"> Aviation and Aerospace</label> <br> <label> <input type="radio" name="stockinfo" value="Banks"> Banks</label> <br> <label> <input type="radio" name="stockinfo" value="Construction"> Construction</label> <br> <label> <input type="radio" name="stockinfo" value="Electronics"> Electronics</label> <br> <label> <input type="radio" name="stockinfo" value="Oil and Gas"> Oil and Gas</label> <br> <label> <input type="radio" name="stockinfo" value="Pharmaceuticals"> Pharmaceuticals</label> <br> </p> <input type="hidden" name="CodeField" VALUE="<?php echo $_POST['CodeField'] ?>"> <input type="submit" name="submit" value="Submit"> </form> </body> </html> For sendinfo2.php to do the check I do not have anything yet... Quote Link to comment https://forums.phpfreaks.com/topic/233404-help-with-an-assignment/page/2/#findComment-1203547 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.