Jump to content

robmo

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling
  • Location
    Seattle, WA

robmo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I also got a suggesting to use a PHP News solution. That looks like it might work but I want to look at your solution as well. Now to get my hands dirty!
  2. I noticed that there many examples of this on the web. I will be working on that the next few days. I'm thinking it would be a good idea to store the announcements in a database since i have to make one anyway. I just need to figure out how i get the data/announcements from the database to an area on the home page. Lots of fun!
  3. Does anyone know how to go about accomplishing this?
  4. A form would work but I wouldn't want the form to be exposed until a user has authenticated to prevent just anyone from posting. The announcements will be posted on the home page of the site and I thought I would place a Div to reserve the space so I don't have to deal with rearranging content when there are no active announcements. I would just leave the "announcement Div" in place at all times. Does that help? Let me know if you need more detail.
  5. Hi, I need to provide the ability for a user to login and post announcements. I have done some searching and haven't really came up with anything that will work so far. I would like to use a script that is external to the web page that will display the message. If that is not best practice, please let me know. My idea was to create a Div that contains a multi-line text box within it and perhaps post the announcement there. I am curious if it would be a good idea to include a database for this task. The announcements will likely be posted by only one user and they will be very infrequent so maybe a text file would suffice. Is this a good approach or is there a better way? I'm not really asking anyone to code this for me but some suggestions for achieving this task would be greatly appreciated. I am trying to move away from using a CMS for this particular site. I have been told that javascript is the wrong approach to this solution and would need to use server-side scripting. PHP was called out for this project. Thanks for your help! Rob
  6. Mainly I just want to follow best practice out in the industry. It sounds like javascript is how it would be done. I do know that if I just use Dreamweaver to set the conditions, it will write the javascript for me. This sounds like the easiest way to go. I'm not necessarily looking for easy, just the best and most popular solution. I don't really want to create a big mess that is hard to understand and maintain. Thanks a lot for your help! I think I know what I need to do now...
  7. I don't need a database in this example. The script only needs to check for blank fields and let the user know that they need to be filled out. If everything is filled out, then php should email the results of the form to me and one other person. I want to include captcha to so it helps to prevent spam. Maybe my php script doesn't need to do as much as I am thinking.
  8. Hi, I have a separate form created using Dreamweaver that calls a separate php script when the Submit button is clicked. Currently I am able display form validation messages in a new html page. If the user leaves fields blank, I would like the messages to appear on the form itself instead of in a new page. How do you make the messages from the php form validation code display into the calling html form? I know I could just do this with Dreamweaver but I would like to learn to do this using php. It might be easier to embed the code within the html page but I was thinking that using the separate script would be more secure. My form can be found here. Validation is working but opens a new page: http://www.tallfirshoa.com/adform.htm Thanks! Rob
  9. Would anyone be able to comment on my last post? I will post my new code once I have working if anyone is interested.
  10. jcbones, Ok, that makes sense now. Unless Submit was clicked though the PHP script would never be called so does it really matter? It sounds like the way I have it is not best practice even if does happen to work in my example. I will move the code as suggested. Should I also move the $errorstring = ""; into that area as well? Thanks again, Rob
  11. hcdarkmage, I'm not sure I understand what you're saying here. Are you saying you have to declare the variables in advance to using them? Like using DIM in visual basic? When I added the missing semicolon after the $errorstring statement, the script started working so I'm not sure how your explanation helps me. Do you think you could clarify your meaning? Thanks a lot! Rob
  12. I can't believe I did that. I guess you go crazy and miss simple things when you look at it too hard and too long. I added some additional code and it does tell you if you need to fill out something. For now it's setup so the PHP script generates a new html page and displays which fields require information. From there, users would have to hit the back button to correct the fields called out. Is it possible to display the error messages on the form itself rather than generating a new page? I'd basically like the Submit to fail and not change the page at all yet display the error messages where appropriate. I like your idea with the array. There are a number of variables and it could really reduce lines of code by looping through them.
  13. Hi, I am trying to setup a PHP script that will validate an html form. The form and the PHP script are separate from each other. The code that I have was modified from a tutorial on YouTube. The example used there works but as I have began to tailor it to my purpose, it is now broke. I just added one line for validation to simplify troubleshooting. If I find an empty field on the form, I would like to display the error message on the form itself rather than start a new html page with the PHP script. I am not sure if that is possible. Here is my form: http://www.tallfirshoa.com/adform.htm YouTube videos that I was working from. The video's example has the form and PHP combined as one. In my case, I need the form and PHP separate. http://www.youtube.com/watch?v=yuLpSospbBk&feature=search http://www.youtube.com/watch?v=LF5zTWthpn0&feature=search The code works fine if I leave out the validation. As soon as I add if(!$fname), the script becomes broken. I'm guessing that it has something to do with $errorstring and how it works. I am new to PHP and have tried as many things as I can think of but I can't make any forward progress. Thanks for your help! Rob <html> <h1>Tall Firs Ad Submission</h1> <?php if ($_POST['submit']) { //Get form data $fname = $_POST['fname']; $lname = $_POST['lname']; $email = $_POST['email']; $displayemail = $_POST['displayemail']; $phone = $_POST['phone']; $category = $_POST['category']; $description = $_POST['description']; //Declare variables $to = "email@gmail.com"; $subject = "Request"; $headers = "From: $email \r\n Reply-To: $email"; } //Setup form validation $errorstring = "" //default value of error string //Begin validation if (!$fname) $errorstring = $errorstring."First Name<br>"; ?> </html>
  14. xcoderx, I think I can take it from here. Just this snippet alone has helped a lot in understanding how use PHP in this application. Thanks again! Rob
  15. Well, I wasn't really asking you to code this for me but thank you so much! I can easily see now how this is done. I just found it very confusing with the HTML intermixed with the PHP code. I'm obviously not a PHP developer but I do write code in other languages. Thanks again! Rob
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.