PHP script interrupted by variable [closed] - php

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I'm trying to create a news system.
I'm implementing the ability to edit the news.
But there is a problem, if i change the picture the system sends the change to mysql. but If you change only the text, as the title or description but not edit the image changes are not updated to databse.
if not change the image, the change does not come. because the variable "file" is empty.
Code:
form: http://ideone.com/e62q84
action: http://ideone.com/q3noFc
see above url for my code.
there is a way to continue entering data even if the user chooses to leave the variable "file" empty?

This is happened because may be you check like if(isset($_POST['file'])) so change this to any required filed i.e. if(isset($_POST['title'])) or you can check with button also like if(isset($_POST['submit'])). Hope this help to you. If your issue is different then please add your code so we can identify the bug with your code.

Related

I need help on figuring out how to get the isset() function to work [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 months ago.
Improve this question
Create a new PHP file called lab2.php.
Inside, add the HTML skeleton code and give its title “Lab Week 2”.
Create a form asking for the person’s name and favourite ice cream flavour.
Store the data using variables.
Use the isset function to check.
Print the results.
PHP CODE
HTML CODE
You should use POST request for sending data from user(.html file) to server(.php file).
In your HTML file, comment this
//<form action="lab2.php" method="get">
and use this
<form action="lab2.php" method="post">
In yout PHP file, you can get data using
if(isset($_POST['icecream'])) {
echo $_POST['icecream']
}

Using multiple forms in php but only one of them is working [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed last year.
Improve this question
Does a single php page contain more than 2 forms? If yes, how can we use it?
Php does not support multiple form action in one form. Instead we can use mltiple submit buttons with unique names so that in php section we can redirect to any page using that button name.

Wanted to store the Url in phpmyadmin coming back from Firebase storage when calling getdownloadUrl method [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I want to store the whole Url of the image in my MySQL database coming from firebase storage when calling getDownloadUrl() method.
When doing the above I'm able to save the url but the token gets cut.
This is what I gets in my database
https://firebasestorage.googleapis.com/v0/b/vibesproject-b54f0.appspot.com/o/UserProfileImages/Shaks?alt=media
and when alerting the same url in the app I got the whole path as shown in the below figure.
How can I store the whole path with the token in the database
This is the App image
Check that the MySQL column length is not too short to store the whole URL.
Actually I would suggest using a column type of TEXT instead of VARCHAR.

HTML5 Responsive one page site with php variables in url [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have just built a responsive HTML5 page, and as such, it links to other parts of the page from the menu... so, I have #home, #about, etc. I also need to pass a php variable for language, so that the correct language displays on the page, so I have lang=es, lang=gb, etc.
The languages are working fine and the links are working fine, but when I combine them both, the links stop working. Either as #about?lang=es or as index.php#about?lang=es. Neither works. It just stays at the top of the page and doesn't jump.
Any clues as to why?
Thanks in advance.
Kirsty
You should pass the php params first and then html tag ID
see the example below
https://domain.extension?lang=es#about
Dont worry about php variable value, it will remain untouched, servers will handle it

Hide ID in PHP/MySQL [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I'm busy with a webpage to make it possible to reply a question. I have 2 pages in written in PHP.
results.php: a while loop that fetchs all rows from the database incl. their id's. Each question has its own id.
<li>Answer this question: </li>
reply.php: this shows a question according its id, but I don't want to show the id in the $_POST like: reply.php?id=1. I have tried to hide the id, through put it in the session but that doesn't work.
Can someone help me out?
<?php
if(isset($_POST['answer']))
{
$id = $_GET['id'];
/*
Each id that belongs to its question needs to changed when you click on another link it has to be looped.
Each time when we click on the answer link, we get the same id constantly but that is not our purpose.
I tried to give in the results.php file to give the id together with the url to avoid SQL Injections.
I placed the ids out of loops and placed it in session. Only the $_SESSION['vid'] stays the same even if I click on another answer link.
*/
}
<Form methode="POST"></form>
will stop showing the ?id=1. but you won't get infomation out of url with $GET[''] anymore.You need to use $_GET[''] to get the infomation out of the url. You can try to use a php rewrite rule to rewrite the url, so it won't show the id anymore.
$_POST[""] will not show any information in the URL. Although in your case if you want to post data from your database on the same page (as example a blog) you should be using $_GET[""].

Categories