Questions tagged as 'php'

2
answers

Default Input Value in Laravel

In%%, I want, when a given value does not exist in Laravel , I can set a default value. With pure PHP, you can do this: $text = isset($_POST['text']) ? $_POST['text'] : 'padrão'; In Laravel I know it's possible to do something like...
asked by 15.03.2016 / 16:47
1
answer

Invert the separated word order with str_replace in PHP

I have a string opção1_opção2_opção3 I used str_replace to separate the options $titulo = str_replace("_"," ",$titulo ); I have a way out opção1 opção2 opção3 I would like to reverse the order to look like this: opção3 opção2 op...
asked by 29.02.2016 / 03:18
1
answer

I can not limit text with Japanese characters

I'm trying to limit the text "in Japanese" that will be displayed in some places of the page, it does not seem like php can handle this kind of character well. Example php :    echo substr ("あ え い う お", 0, 3); Here it shows only "あ" an...
asked by 14.03.2016 / 08:59
2
answers

How to display the http request from a browser, and the http response from the server

I would like this information to study full examples of https protocols with Cookie and Sessions, whether via Java Socket, PHP. If possible through the browser itself.     
asked by 07.08.2014 / 18:27
2
answers

How to write this MySQL code correctly?

I'm trying to adapt to mysqli_ since mysql_ can be at any time discontinued now that new concepts like mysqli_ and pdo have appeared. I am trying to write this script that pulls the information from the database but it is not working. What could...
asked by 15.08.2014 / 16:09
2
answers

Is it possible to always write in the first line using PHP?

Well, I want to make PHP always write in the first line in a text file, that is, I want it to never write below or in the text. Put simply, I want him to write before the texts. Is it possible?     
asked by 13.10.2016 / 02:24
2
answers

Form: one choice is free, two have to charge. How do I do?

I have a form, where each selected product has a value, and at the end of the form has the total, all this works through the form.js file follows code: var str = ""; var id = ""; var sub = 0.00; var taxa = 0; var taxadeentrega = total - taxa;...
asked by 26.09.2016 / 20:48
2
answers

What is the interface for Countable in PHP?

I saw a certain class whose declaration was this way: class Collection implements Countable {} I noticed that she was implementing Countable , but I did not understand what that implementation was doing there. What is the purpose o...
asked by 07.10.2016 / 20:09
2
answers

How to read what the user typed in a form?

The code looks like this: <form method="post" action="pagina.php"/> <?php $c= 1; $neg = 0; while($c <=3){ echo "Digite um numero: <input type='number' name='$num' min='1'/>"; if($num < $neg){...
asked by 29.09.2016 / 01:12
1
answer

Return to the previous screen after registering using Kohana

I have a screen where I get a parameter (id) and from it I mount a form. After saving this form I need to return to the previous screen to display what was saved. How can I do this? I have tried in many ways, several Requests but nothing wor...
asked by 06.03.2014 / 23:16