Getting INFO in PHP [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
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

Related

How do I make a form change text in a different PHP/HTML file? [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 7 years ago.
Improve this question
I'm making a "banner.php" thing that's included in every single page of my site so I can have alerts about when site maintenance is, etc.
So my question is,
How do I make a form change text in a different HTML file?
As in: Make a page (admin.php) or some page like that have a form with a button. Whenever I change the form and hit the button, it makes banner.php's text change.
I know it would involve a variable in the banner.php file, but I'm not sure how to execute a line of code that would change said file from a different file.
you can read the banner file
$banner=file_get_contents("banner.php");
so after doing the changes in a form or wherever you can save your data in the file and overwrite it:
file_put_contents("banner.php",$banner);
There are many ways to achieve this, the simplest would probably be to store your new content in a file.
Something along these lines:
admin.php:
<form action="save.php" method="post">
New value: <input type="text" name="new_text">
<input type="submit">
</form>
save.php:
<?php
file_put_contents('banner_content.txt', $_POST['new_text']);
banner.php:
<?php
echo file_get_contents('banner_content.txt');
This is extremely basic, and I would definetely not recommend that you use it as is - it has no security measures whatsoever, and is probably not very useful on it's own either... but it's a starting point if you are completely blank.

When Someone Hits Enter Break Text [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
I am creating a forum software for my first time I know most of PHP just not a few things.
Anyway,
Say when someone hits enter like on this
"Like this i just hit enter"
It will display as a new line when the topic is posted how can I archive this?
Right now even if I went to a new line the post will still display like this "sssssssssssssssss" the user needs to add to break it but I need to disable HTML for security reasons.
I now I could get PHP to add automatically when the post is submitted but then will be displayed to the users and I be disabling html.
Thanks!
You need to use the nl2br() in the PHP. It automatically converts the linebreaks to <br> tags.
Say if the user typed data on the <textarea> of your form and when he clicks Submit , it reaches to your PHP page say submit.php , in that page you should be doing like this..
submit.php
<?php
$textareadata = isset($_POST['textareadata'])? nl2br(htmlspecialchars(($_POST['textareadata']))) : "Not Sent";

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"

Passing form entries to query a database passed and updated to a div tag using AJAX [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
I'm trying to create a page with an AJAX style form. Where on submit, the values in the form search and query a database and output the search results into the same DIV as the form was.
Any help would be much appreciated.
Thanks
jQuery is probably what you're looking for...
The docs are straightforward. http://jquery.com/
Generally, jQuery follows the find something then do something approach.
Find something ---> watch for some action on some element (in your
case, clicking submit)
Do something ---> make an ajax call to the php page you want to run
the query and return the results then insert the results where you
want on the page
http://api.jquery.com/jQuery.post/
Some other helpful jQuery commands for this task could be...
http://api.jquery.com/appendTo/
http://api.jquery.com/remove/
http://api.jquery.com/append/
Hope this helps.

How can users post after posts of others? [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
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.

Categories