When Someone Hits Enter Break Text [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 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";

Related

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

Would this be hard to do? [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 8 years ago.
Improve this question
I want something like this to happen...
A user has a text field and a button, he enters text in the field and clicks the button it will go to a URL. Once it goes to that URL it has a text field, this field would be automatically completed from what the user typed in at the start. On that URL there is also a button, that is automatically clicked once the text field has been automatically entered.
BUT the user only sees the first page where he entered text in the field and clicked the button. Everything that happens after he clicked that button he cannot see.
Is there a particular phrase you would call this from what is happening? If so, what is it and how would I do it? This probably is hard to understand but I tried :/
You can try out different roles and workflows. It sounds like a simple admin or publishing tool.

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.

question about POST and redirect [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 8 years ago.
Improve this question
So I have a html form and I have an URL where it will be submitted, say the URL is www.myformsubmit.com/form_submit.php. This form_submit.php will give me a text saying if everything is correct in the form or prints out an error message.
What I want to do is that to do is that after the form is submitted to form_submit.php I want to redirect users to a thank you page. My question, is there a way to do this without having to touch the form_submit.php, if yes how?
With your current setup, you can't redirect to another page without modifying form_submit.php.
You can have the form submit to itself, and then do something like this:
<?php
// Optionally, also make sure that there are no errors.
if (isset($_POST["SomeInputValue"])):
{
// Must be BEFORE any output is sent!
header("Location: /thank_you.php");
}
else
{
// Display the form page.
}
?>
My question, is there a way to do this without having to touch the form_submit.php, if yes how?
You want to check if everything is fine from form_submit.php but you do not want to post data to it? I think this is really not possible.
is there a way to do this without having to touch the form_submit.php,
if yes how?
The short answer would be no. To correctly answer your question we need to know why you cannot modify form_submit.php. This is because a simple line of code could be added to redirect to a "thank you" page when the form is correctly filled in.
(Will edit this accordingly as the question is developped)

Ajax for DB Updation [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 updating 100,000 records. So the page looks blank while the update query process runs on the backend. Can someone tell me how to display the text "Please wait blah blah" until the update ends?
Well depending on your script and the structure, the easiest way would be to change a div's css property called display. When a user clicks on a link that starts the php script, you could add a javascript code like :
$(#+THEIDOFYOURDIV).show("slow");
});
and once its done, you can call another js function to close it like :
$(#+THEIDOFYOURDIV).hide("slow");
});
*NOTE I am using jquery functions, so you would need to include jquery in your pages.
There is another way you could do this using php ONLY, I had the same issue so take a look at this: how to show results while a php script is still running

Categories