Category : variables

I would like to delete one last word of String variable in PHP. I tried to do it according to this code: https://stackoverflow.com/a/29428662/10490051. But it doesn’t solve my problem. I would like to use it for SQL argument: $sql_request = "SELECT fullname FROM names WHERE lastname=’johnson’ and city=’oxford’ "; $sql_request = preg_replace(‘/Ww+s*(W*)$/’, ‘$1’, $sql_request); echo ..

Read more

i want to save multiple user information in another page in PHP. i have a form where user input some information,like name, city…so on & i want to save those information in a table. I have used session but it overwrite the previous record. h3>Contact Form</h3> <div class="container"> <form method="post" > <label for="fname">First Name</label> <input ..

Read more

So i’ve been having an issue using a PHP variable to fill the value of a text input field. For some reason when I try it like this: echo "<td><input id=’".$p_nameid."’ name=’".$p_name."’ type=’text’ value=’".$authname."’></td>"; It will not work. But when i remove the id: echo "<td><input name=’".$p_name."’ type=’text’ value=’".$authname."’></td>"; It works perfectly fine I need ..

Read more

Let’s say I have a lot of functions like the following, and will be making more involving some variable. For example, I’ll use timezone… function tell_time($values, $timezone = "Greenwich"){ // Do something dealing with the timezone } function expected_arrival_time($values, $timezone = "Greenwich"){ // Do something dealing with the timezone } function delayed_shipment_arrival($values, $timezone = "Greenwich"){ ..

Read more

I’m facing a bit of a roadblock in my script. I’ve been using the following code in my PHP to send variables into my Javascript files, for use with a price slider. .php <div class="border p-4 rounded mb-4"> <div class="mb-4"> <h3 class="mb-3 h6 text-uppercase text-black d-block">Price</h3> <div id="slider-range" class="border-primary"></div> <input type="text" name="text" id="amount" data-path="/<?= $foo[‘uri’][‘path’][‘controller’]; ..

Read more

i have a wordpress website, as the sessions are not activated by default I did the following code in my function.php: function ur_theme_start_session() { if (!session_id()) session_start(); } add_action("init", "ur_theme_start_session", 1); now I am getting value from URL and storing it in session like below: $_SESSION[‘accessory’] = $_GET[‘item’]; $accessory=$_SESSION[‘accessory’]; the sessions variable is only echoing ..

Read more