fefster Posted October 23, 2012 Share Posted October 23, 2012 Hello, I have a couple of questions, but I am a real beginner and don't want to make a faux pas by asking silly questions. Is this the right place for me? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/ Share on other sites More sharing options...
ManiacDan Posted October 23, 2012 Share Posted October 23, 2012 Of course, go right ahead. Make a new thread for every general question you have. Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387211 Share on other sites More sharing options...
Beeeeney Posted October 23, 2012 Share Posted October 23, 2012 Ask away! I'm a beginner too and so are a lot of people on here. Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387212 Share on other sites More sharing options...
Jessica Posted October 23, 2012 Share Posted October 23, 2012 Of course, but do be sure to provide the relevant information for the question, and that it's not something you can easily google like "how do I convert a string to uppercase" or something Cause then we'll give you a hard time. Read the links in Dan and my's signatures for advice on getting good help. Best of luck Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387213 Share on other sites More sharing options...
fefster Posted October 23, 2012 Author Share Posted October 23, 2012 Thanks very much! So I have a contact form, which queries a SQL database and I want the action to go to my Moodle site, but I'm getting an error 404. The code is this: <form action="http://www.institute-of-photography.com/moodle/login/index.php"> id="voucherForm" method="post" class="voucherForm"> What have a I done wrong? Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387214 Share on other sites More sharing options...
White_Lily Posted October 23, 2012 Share Posted October 23, 2012 Error 404 only appears when the page in question does not exist, try making sure the link is spelt right and the page you want them to go to exists. Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387215 Share on other sites More sharing options...
Psycho Posted October 23, 2012 Share Posted October 23, 2012 (edited) Thanks very much! So I have a contact form, which queries a SQL database and I want the action to go to my Moodle site, but I'm getting an error 404. The code is this: <form action="http://www.institute...gin/index.php"> id="voucherForm" method="post" class="voucherForm"> What have a I done wrong? Any ideas? You want your form to POST to a login page? Are you trying to build a "pass-through" so someone can enter their login credentials on your form and be automatically logged in to that site? Could be that site is detecting that and refusing the form submission. EDIT: I just did a quick test of copying the form on that login page and submitting to it. I received the error "ADONewConnection: Unable to load database driver", so it is not detecting external form submissions. But, if the name of the form is any indication I don't think you are building a pass-through login form, so I don't see why a voucher form would be posting to a login page. It *could* be valid based upon the logic of that page, but I certainly wouldn't think that is the case if the logic of the site is separated into separate fiels as would be the norm Edited October 23, 2012 by Psycho Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387216 Share on other sites More sharing options...
fefster Posted October 23, 2012 Author Share Posted October 23, 2012 Error 404 only appears when the page in question does not exist, try making sure the link is spelt right and the page you want them to go to exists. Hello, Thanks for replying. I copied and pasted directly into another browser and the link is fine, it just dosen't work as an action. I thought I might have had a piece of code wrong. Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387217 Share on other sites More sharing options...
fefster Posted October 23, 2012 Author Share Posted October 23, 2012 You want your form to POST to a login page? Are you trying to build a "pass-through" so someone can enter their login credentials on your form and be automatically logged in to that site? Could be that site is detecting that and refusing the form submission. It could be that. It is Moodle, so I wonder if I need to authenticate it. Anyone know anything about authentication in Moodle? Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387219 Share on other sites More sharing options...
White_Lily Posted October 23, 2012 Share Posted October 23, 2012 (edited) <form action="http://www.institute-of-photography.com/moodle/login/index.php" id="voucherForm" method="POST" class="voucherForm"> Try that instead. Edited October 23, 2012 by White_Lily Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387221 Share on other sites More sharing options...
fefster Posted October 23, 2012 Author Share Posted October 23, 2012 (edited) Sorry that post didn't work!! Edited October 23, 2012 by fefster Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387223 Share on other sites More sharing options...
fefster Posted October 23, 2012 Author Share Posted October 23, 2012 You want your form to POST to a login page? Are you trying to build a "pass-through" so someone can enter their login credentials on your form and be automatically logged in to that site? Could be that site is detecting that and refusing the form submission. EDIT: I just did a quick test of copying the form on that login page and submitting to it. I received the error "ADONewConnection: Unable to load database driver", so it is not detecting external form submissions. But, if the name of the form is any indication I don't think you are building a pass-through login form, so I don't see why a voucher form would be posting to a login page. It *could* be valid based upon the logic of that page, but I certainly wouldn't think that is the case if the logic of the site is separated into separate fiels as would be the norm Well, what I'm trying to do is have a 'voucher redemption page'. Users would get a special code, fill in their details including the 'voucher code', this would query a database and if the code was recognised, it would allow login to Moodle. This is so that I can sell my online courses through Groupon for example. What do you think? Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387224 Share on other sites More sharing options...
Psycho Posted October 23, 2012 Share Posted October 23, 2012 Then it sounds like you should be submitting the form to a different page - not the login page. You *may* have coded it to work that way, I don't really know. But, I would create a page called something like redeemVoucher.php to submit that form to. Have that page do the validation and if everything passes, set a session value and redirect to the login page. On the login page do a check for that session value, if not set redirect to the voucherForm page. Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387229 Share on other sites More sharing options...
fefster Posted October 23, 2012 Author Share Posted October 23, 2012 Then it sounds like you should be submitting the form to a different page - not the login page. You *may* have coded it to work that way, I don't really know. But, I would create a page called something like redeemVoucher.php to submit that form to. Have that page do the validation and if everything passes, set a session value and redirect to the login page. On the login page do a check for that session value, if not set redirect to the voucherForm page. Wow that sounds exactly the right thing to do, but I've gotten lost in the translation a bit. Sorry :-) That did work a bit, I changed it to the right page name which I found in the php file and it is now taking me to the Moodle login page, but when I use the username password to login, I get that ADO Database thing and I'm not sure what to do next. Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387231 Share on other sites More sharing options...
Psycho Posted October 23, 2012 Share Posted October 23, 2012 The issue you are having doesn't seem to have anything to do with your original question. Sounds like you are unable to get your Moodle installation working - then this is the wrong forum. This forum if for getting help with PHP code you have written. You should probably post in the Third Party Scripts forum: http://forums.phpfreaks.com/forum/26-third-party-php-scripts/ Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387235 Share on other sites More sharing options...
fefster Posted October 23, 2012 Author Share Posted October 23, 2012 Okay, thanks very much Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387239 Share on other sites More sharing options...
computermax2328 Posted October 23, 2012 Share Posted October 23, 2012 I was a huge noob when I found this forum too! Now I am an "Advanced Member." Doesn't mean much, but it makes me feel good. There is one of the resources I use to learn PHP. Everyone is really nice here. I am here almost everyday now. Ask away! From one new guy to another I would also suggest checking out website critique and the miscellaneous forum. Lots of fun stuff going on there. Quote Link to comment https://forums.phpfreaks.com/topic/269818-is-a-beginner-welcome/#findComment-1387274 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.