How does a user submit an article on a website? - php

I am working on this travel blog Trippindian.com . I want to build a page where a user can login via facebook and then write an article and submit it to us. Its just like I am posting a question on stackoverflow.
just FYI I am a noobie coder.
I want to understand the logic and functionality behind this.
Thanks

First, you need a database where you can store all these posts.
And then, you would need to create a page with a form element (HTML).
You would also need a php code that connects to the database and adds the value or values contained in the form.
That's pretty much what you need.
You could find other solutions, but I think it's the simplest one.

Related

Best way to get data from non-admins internal to an organization in Wordpress

Here's the scenario:
I want to display a music playlist for each DJ at a radio station on my Wordpress site, but I don't want to have to enter that data in (Each song, artist, album, etc), in a specific custom post type or something like that.
I want each DJ to have access to a form where they can enter the playlist data in, and I can use that data. I was thinking of making a little webpage form that they can access, and then I query the database to get all that stuff, but I imagine that maybe there is an easier way using Wordpress.
The thing is, I don't want to give each DJ admin access to make posts with those custom fields filled in, so I'm not sure if there's a way to do that.
Maybe a page on the website that is password protected to fill out the form, and then I can use that data in a different page on the site? (Password protected so I'm only receiving data from actual DJs, not random people or bots.)
Sorry if this is an ignorant question, or if I'm unclear.
I searched a little bit, and couldn't find much.
Thanks in advance for ideas and insight!
You need to decide your method for doing this and try it out, when you run into a problem then you post here. It sounds like you know what you need. You're looking for a password protected form (which will check against a database) and pages based on a query to the database. This can be done in PHP or you might be able to find a Wordpress plugin to help you out.
Maybe start by making the PHP form. Then you could add the password protection. After you have that working you could make the PHP page that would query the information submitted. Take it one step at a time. It'll be much easier for people to help you if you're troubleshooting a specific issue rather than trying to figure out the logistics of how the whole system will work.

Auto-update Posts without refreshing

I'm currently only using PHP to take user submissions, put them in a database, and echo them out on a page using SQL to select from a table, such as comments. I need a system that will automatically update comments without refreshing the page like on YouTube. The less the user has to manually update, the better.
I want it to work pretty much exactly how YouTube and Twitter function, where it'll say "x NEW COMMENT(s)" and clicking that updates everything.
My teacher recommended a JQuery function, but I don't have any background in that language so I don't know where to begin looking.
I'm at a complete impasse. I will update this if you guys need additional information to aid in my search.
You are looking for AJAX
You will need a HTML page with jQuery/AJAX that calls another PHP page. In that PHP page you do the DB request and then ideally return the data as JSON so that your frontend part can display it to the user.
As every one says, AJAX is the way. You can find a simple blog I did on it here.

jQuery list that saves user selection (like a cart)

I'm working on a travel website. I'm looking for a function that allows my users to click a hotel and save their selection to a "list" on the sidebar.
I want it to function like a cart so that the list never erases and so that you can see the selection until you are ready to print everything out.
Any help/suggestions are appreciated.
Thanks!
If your users are going to be clicking around to a lot of pages, it will be a real challenge to keep sending this growing list around from page to page on the client side. I would recommend that you consider a different approach. One is cookies, and another is session state.
If you are using server-side code, it would help us to know what language you are using so that we can give you some more ideas.
I would suggesting using AJAX to pass the selection to the backend. If you want this to persist across multiple sessions you're going to want to save it to a database so they can come back later.
http://api.jquery.com/jQuery.ajax/
Use cookies if you don't want to use php.
http://www.w3schools.com/js/js_cookies.asp
has a good example of how to use cookies in javascript.
I recommend using "My favourite posts" wordpress plugin for this kind of job.

How to use form information to auto populate a form on another webpage

I am trying to figure out a way that I can populate form fields on webpage for my users much like password managers do. The problem is that I am not the owner of the second webpage. I thought about using javascript with iframes but that doesn't work. I've tried using php to replace the form information adding values saved from my previous form. But I need to add info on a second form after the first one is submitted. After I submit the first page I am off my page and can't change anything else. So I'm kinda out of ideas and my knowledge is limited. Any ideas or input would be greatly appreciated. Thank you for your time and effort.
Cannot be done because of the SOP (same origin policy) enforced on JavaScript code. An alternative would be through XSS, other via a bookmarklet, and as a last choice trough a GreaseMonkey script.
GreaseMonkey may be your best choice, if the data to be filled in is from your website. Best choice because GreaseMonkey scripts can perform cross domain ajax requests.

web design question (php/ajax)

Hope this isn't a waste of your time. I'm working on a project, and it occured to me that there's a chunk of code out there, that should allow me to see how others have implemented this.
I've got a project where I'm going to have a page, with a sel box. the user will select an item from the selList, and based on the item selected, a separate section of the page (areaB) will change in terms of the content/tbls being displayed.
i then want to allow the user to go through a series of subpages in areaB, where the user goes through a submit/cancel/confirm process, where the stuff in areaB changes, with the rest of the page remaining the same...
i'm trying to figure out the best approach to implement the on both client/server side.
i could just have an ugly "if block" where i have abunch of logic, and i completely regen the page each time the user selects an action..
i could have an approach that might involve divs/frames, where i then just regen the targeted frame/div area.. is this even possible??
i could have some form of ajaxy process, which would only alter the targeted section(s) of the page...
so.. i'm trying to talk to anyone who has ideas on how to do this, or more ideally, if you know of a good code (client/server) side example of this... that i can examine. i'd really appreciate it!!
i've got a more detailed overview but didn't know if it would be cool to post it here...
thanks..
tom
If i've understood good this can be done in axaj. This is my idea you will have a where you load the current page with a form. After the submit button is pushed the values from form will be subtmited to an procesor let call it formprocesor.php. In formprocesor.php you will have a case that will check the step where you are in your submited for and will return the corect values to ajax proccessor in the main page. After values are recived, the ajax proccessor will display them in the result
Here is a little example: http://24ways.org/2005/easy-ajax-with-prototype there are more on a search on google with "ajax prototype tutorial"
Good luck!

Categories