How can users post after posts of others? [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to display an add comment button(like in here or FaceBook) for all of the users' posts.
As you can see in here, if you click "add comment" button, small input box opens and your comment appears right below where you add it with smaller size than normal posts.
I am confused about which language would be the best for this. I know a little about JavaScript and jquery but i think doing it with php is not possible. An idea or example to do that would be greatly helpful.

JavaScript shows the form field, than makes an Ajax call to the server when the person clicks the add content button.
The server saves the content to the database, and returns a success message.
If successful, the JavaScript shows the comment and hides the form fields.

JavaScript and jquery its a client side technologies. Php is a server side. You need a proper database design and can choose any sever technology you like.

Related

Creating dynamic bootstrap modals with php mysql and ajax [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
so I am working on a small ecommerce site and I've been stuck on this section of my site for quite a while now and can't really wrap my head around it.
I have divided the site into 3 columns with bootstrap's grid system, in the main section I have my featured products, however, I'd like everything to be dynamic, when I click on a modal with "View details" for the product the only code that works is the dynamic one, I'd like to know how to make it so that it pulls the data directly from my database, unfortunately out of frustration I deleted the little work I had done on it and can't show stick it on here so that anyone can correct it for me.
Could anyone please help me out?
Thanks!
There are many ways you could go about doing this. Here is an approach you could use:
Get the id from data attribute of your product (make sure you load it into the html).
Send a $.get request with jquery for this id to the server.
Get the data needed from the db using this id.
Render the data server side
Return html
In the callback function of your get request put the HTML into your bootstrap modal body.
Show the modal to the user.

Getting INFO in PHP [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
So, I made a thing where it gets the connection of a game server when you put it in a search box and press submit. Now, what I want it to do is to get the information when I type something like http://link.com/search.php?serverName=hello.com
and that hello.com would be the thing that it gets the information for.
You should consider looking into something called GET which can be added to your HTML form, which essentially adds the content entered into the 'searchbox' onto the URL at the top.
You can try it out using something like this..
<form action="search.php" method="GET">
<!-- Your form components here -->
<input type="submit" value="serverName">
See above that the value of the submit button needs to be set to what you want to appear at the end of the URL, in this case it would display '?serverName'
Then in regards to processing this data, you will need to look up searching algorithms in PHP, the best method is a FULL-TEXT search, but can be quite complicated to do, there are others that will get the job done.
http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
Some more useful links:
http://www.w3schools.com/html/html_forms.asp
http://www.tutorialspoint.com/php/php_get_post.htm

How do I allow the user to make a change to my site's appearance via php? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Let's say hypothetically that I have a Div that contains the background color 'red' and I would like the user to input into a separate input box to the side of the div what color he would like this box to be changed to. How would I go about allowing this type of functionality through php so that the color chosen (and not the default 'red') remains as the color once the user has left the webpage and another has logged on?
Basically how can I allow the users choice to be final so that users can see this afterwards?
Thanks in advance!
You cannot do it on a client side. The HTML code should be generated on a server side and along with addition to DOM, AJAX call should be made to server-side script to include new elements in subsequent generations.
And you should also provide some sort of authorisation, or else your website will be full of Viagra and Forex links in no time...
You have to send the number of appended items back to the server and the server has to store that number in a database. Then, the next time the page is requested, the server can either render them or it can send the information to the client and the client can render it.

PHP & SQL: requests to mysql updates without refresh page [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have an img with a link of a request next every reply in one post. and it allow the author of the post to select the right answer. if you clicked on the img it will do a request...
the request will update the reply to be the right answer reply (* similar to stackoverflow.com)
the problem is when I do that, it always send me to the top of the page. I think it refreshs.
I want to avoid refreshing or sending me to the top of the page. I want it to do nothing but the request.
some people told me the solution is javascript. but how ? because I can't with javascript do requests nor sql updates ... ?
JavaScript can make requests to the server without refreshing the page. Usually, a library such as jQuery is used to make the process easier.
In your example, JavaScript needs to do two things:
Tell the server (php/mysql) what answer was selected as correct so that future visitors see the change
Update the client (browser) to show the change.
That should be enough to get you started - you are going to need to learn quite a bit. Read the docs at jquery.com and search for code examples.

Pulling info from an external page [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Okay, bear with me. Part of my job is filling out online forms for customers who call in. In these forms there are all kinds of useful information that is hidden in input tags. I would like to make my own page that would extract and display all this useful information. I would also use this page to count the number of times I submit the form throughout the day.
The way I currently have it set up it is in a frameset. The left frame has links to the different forms we fill out, and when I click on one the external form is populated in the right frame. Javascript would be perfect for the job except that my frame is not located on the same server as the forms.
I stink at PHP. Not gonna lie. So i'm not looking for any hand-outs but any pointers would be great.
For example you may check out the forms on http://www.youcangetacar.com and you may use the pin code "A101" or you can check out what I have so far at http://customertrack.host-ed.me/
Make a page that cURL’s the page that is passed to it via url(curl.php?url=http://www.google.com) and then you dont have trouble with same domain policy.
Don’t forget to string replace relative urls with absolute urls.
eg, action="/submit/form.php" must become action="http://www.domain.com/submit/form.php"

Categories