Url forwarding with php


I’m using this jquery on my page, because it is required for the text editor
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

The redirect below does not work
echo '<meta HTTP-EQUIV="refresh" CONTENT="01;URL="page.php"">';

Url redirect works if i use this
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>

However, the LineControl editor does not work

What should I do?

Thany you

HUH? You want to redirect a jquery file on Google’s system and another on Jquery’s system? Why?

Just get the version you need and store it on your server. Then, use a local link to it.

One other thing… You can use both jquery libraries at the same time. I have done it. But, sometimes, you
will need to put them in a certain order to make all of the codes work correctly. Not sure which should be
the first one between 2.1.4 and 3.4.1… Good luck…

I have the option to edit from my page and when I save the current data to the database, I use redirect to refresh the page
I don’t understand,
How does jquery block PHP

Well, first, a “REFRESH” is normally only used for the current page. It is NOT a “REDIRECT”.

Normally, you post your data to the same page which saves the data and refreshes the page display.
You can use the refresh to redirect, but, it is very unsafe and insecure. Remember that any code on the
client side like Javascript can be read and altered by a hacker. Normally for redirects you handle them on
the server-side code to keep it secure.

Perhaps you should explain why you would want to do this? If you just want to include a text editor in your
page, you can use free plugins which are WYSIWYG (What You See Is What You Get) and are very easy
to use to save edited text to a database. These are normally used using standard POST data and you
can then do any needed redirection in the PHP code where needed using the standard HEADER code.
Something like CKeditor or TinyMCE will work fine. I have used both of these. You really never want to
send data to another page without protecting it first. That is why you would want to use PHP, not code
that is processed in the client.
Just in case you do not understand this, PHP and MySQL databases run SERVER-SIDE. A hacker can
not touch that code directly. Javascript and HTML META code is run CLIENT-SIDE and is easy to hack.
Just go to any page in the world that uses fancy displays, right-click on the page and VIEW-SOURCE.
You will see the Javascript and META lines that they are using. SERVER-SiDE code is always much
more secure.

Perhaps you should explain further on what you are attempting to learn and we can dummy up a test page for you to try. You only talked about redirect and meta’s and did not show any code to explain why you would need to use them. Redirects are usually handled at the server using simple header commands such as: header(“LOCATION: page.php”); Which will stop the current page and change pages.

Not sure if all these comments help, but, hope so. Good luck!

I reread you posts. Perhaps since this is in the learning-php section, you are not clear on some things.
If you create a page like this;

<?PHP Some PHP code to read posted data and update it to the database ?>

< html> Some html to display a form with data pulled from the database < / html>

And, in the html section, inside the form data, you include a text area or WYSIWYG plugin, you would always show the current live data. If you post the page, the PHP code would update the database BEFORE the html code would load the values and display them. So, there is no real need for a redirect.
Perhaps that was your question. Hope that clears it up. Sorry I did not catch that at first!

I’m newbie,
I have a hard time telling
I will prepare a demo and video

Hello again,
Screen Video

Example code form on my page

<meta http-equiv="Content-Language" content="tr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="jswindow/jswindow.css" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>        
<script type="text/javascript" src="jswindow/jswindow-min.js"></script>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link href="css/mavi.css" type="text/css" rel="stylesheet">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="js/editor.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link href="css/editor.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="js/urunleri-sil.js"></script>

$say = $mysqli->query(" SELECT * FROM multiswitch WHERE urun_kodu='$urun_kodu' AND id NOT IN($_POST['product_edit_id'])");

if($say->num_rows == 0){
    $sorgu = $mysqli->query("UPDATE multiswitch SET urun_kodu='$urun_kodu' WHERE id='$_POST['product_edit_id']'");
        echo '<br /><br /><center><b>Multiswitch Successfully Changed</b></center>';
        echo '<meta HTTP-EQUIV="refresh" CONTENT="01;URL="multiswitch.php"">';
        echo '<br /><br /><center><b>Multiswitch Could not be changed due to an error!</b></center>';


$say = $mysqli->query(" SELECT * FROM multiswitch WHERE urun_kodu='$urun_kodu' ");

if($say->num_rows == 0){
    $sorgu = $mysqli->query("INSERT INTO multiswitch (id, urun_kodu) values (NULL, '$urun_kodu')");
        echo '<br /><br /><center><b>Multiswitch Product successfully added</b></center>';
        echo '<meta HTTP-EQUIV="refresh" CONTENT="01;URL="multiswitch.php"">';
        echo '<br /><br /><center><b>The Multiswitch product could not be added due to an error!</b></center>';



HTML tables and codes are here

Well, I did not study your code, but, I think we need to explain a few things to you. First is SERVER vs the
CLIENT. PHP runs SERVER-SIDE. You have code on your server that runs as a PHP file. This code can
access databases, write HTML to send to the browser, set option parts of the HTML and Javascript data
based on your needs. The code that runs SERVER-SIDE is NOT ever seen on your browser. Only the
results of that code. Therefore, hackers can not get into your PHP code to cause issues. That is why you
should do as much as possible in the PHP side of things to prevent outside interference.
Now, once all of the code on the server is completed, the results are sent to the browser. This is the CLIENT
side of the system. In the CLIENT which almost always is a browser, the HTML, Javascript, JQuery and
other code takes effect and handles further processing.
Redirects are normally done only in PHP on the SERVER-SIDE of the system. That way, hackers have
no control over it. If you handle redirects in the CLIENT-SIDE, meaning the browser, hackers can see all
of your code and possible find a hole it in to hack your server.
Now, in your code you got thru some odd checks for posting of an ID number and then change meta’s.
Normally, you would just use a HEADER() function to change pages depending on the ID number, not use
meta’s for that. To explain a little further… If you are checking for a posted value, such as your code for
$_POST[‘product_edit_id’] , then you are already doing this in PHP. Normally, you would process your
input data there and then use header(“LOCATION: multiswitch.php”); to switch to that page.
What your code is doing is changing a meta line in HTML and then sending that to the browser to just
go back to another page in PHP on the server. You should just do it in the PHP SERVER-SIDE instead.

Not sure I explained this fully. Hope it helps…

I’m a beginner beginner,
This page is in the administration panel
Admin cannot see without login

Thank you for your clarification
A little difficult for the novice to understand them all

No problem at all ! We are here to help everyone, beginner or not. To explain Meta’s a little more, here is
the definition of it:

The < meta > tag defines metadata about an HTML document. Metadata is data (information) about data. < meta > tags always go inside the element, and are typically used to specify character set, page description, keywords, author of the document, and viewport settings.

Mostly used for info about data, not for re-directing to other pages. When you get further on, let us know of other issues. Or, you can start new posts for other questions. A lot of very experienced programmers
help on this site! Beginners are welcomed…

I want to evaluate this information

All together, I have trouble understanding

1st. Do I need to add this to the top of every page?
Which is more correct?

<!DOCTYPE html>
        <meta http-equiv="Content-Language" content="tr">
        <meta charset="UTF-8">
        <meta name="description" content="Merkezi Uydu Sistemi Fiyat Çıkarma Web Sitesi">
        <meta name="keywords" content="Uydu, Uydu Anten, Çanak Anten, Merkezi Sistem, Uydu Sistemi">
        <meta name="author" content="Adem GENÇ">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="jswindow/jswindow.css" type="text/css" />
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>        
        <script type="text/javascript" src="jswindow/jswindow-min.js"></script>
        <link rel="stylesheet" href="css/bootstrap.min.css">
        <link href="css/mavi.css" type="text/css" rel="stylesheet">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
        <script src="js/editor.js"></script>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
        <link href="css/editor.css" type="text/css" rel="stylesheet"/>
        <script type="text/javascript" src="js/urunleri-sil.js"></script>
        <title>Merkezi Uydu Sistemi Fiyat Çıkarma Web Sitesi</title>

Yes, you need all of that at the top of every single page. Here are my thoughts on this…
All of the “meta” lines are explanations of what your site is about. Each of these are the same for the entire
site and therefore part of every page in your site. You would want every single page to show these. And,
that means you need them in your header file. The “script” lines are for code that mostly are needed due to
you using libraries. For instance, the Bootstrap library is extremely handy for layouts and speeding up
your development of the site. This would be needed for every page. It in turn needs Jquery which saves
a lot of work for you as it supports the Bootstrap library. These would be needed on every page. And,
the “link” lines are also needed on every page as they link various other libraries that are needed for each
page to support the other sections. And, of course you want the same TITLE on each page to name the
Therefore, yes, you need all of these at the top of every page in your site. Remember, the meta lines do
not add any “bloat” or large amounts of data to your pages. The libraries do add a lot to pages, but are
not a big problem since you need all of this code. Normally, your header file which includes all of the
above items would be on every page. This makes your site similar at the top for every page.
Hope all these comments help you understand. By the way, your footer file should be similar. In that
bottom of all the site pages, you normally have a copyright notice and quite often things like an email link
or special icons to other sites of importance. They are always the same on every page.
Good luck with the rest of your site…

One further comment on this last question…

You can do every page different, but, users that view the pages will have problems getting around your site.
Also, normally, just at the bottom of this header section, you would also include your site-wide navbar.
Navigation bars usually contain the HOME button to get back to the first page, login area, logout area, site
wide notices and other things that stay at the top of each page. Below that navbar, you would include
the content which is different on every page depending on the page the user requests.
And, of course, navigation bars can be across the top, down the left or right side or can float on the page.
I personally like them at the top or left side. Floating navbar’s are annoying and the right-side ones are not
really comfortable to most users.

Just wanted to add that to the previous post…

Thank you very much for the information

My script is not a regular web page
It is a script to generate a price quote for the central satellite antenna TV system of an apartment.
Wizard for visitor available

  1. Apartment address and contact information
  2. Satellite selection
  3. Dish antenna selection
  4. LNB selection
  5. Antenna Cable Selection
  6. F Connector selection
  7. Multiswitch and Amplifier selection
  8. Receiver selection (optional)
  9. CCTV selection (optional)
  10. Local Antenna selection (optional)
    Price Offer Has Been Produced

There is a management panel for the administrator

This script for myself
I am trying to write


Very interesting application. Are all of these linked to hardware, or is it just a program for quoting a price?
I am not clear what you really need help with. A simple quoting system would be a list of drop-downs with
all possible options listed. Then, once all of them are selected, you would press a button to create the cost
of the system selected.

What part are you stuck on? You do not need redirection for this.

yes, just to give a price quote

Not so simple but it is not overly difficult (It is difficult for me)
Products vary depending on the number of satellites selected and the satellite
It is not a stock program. However, it lists the products by looking at the stock situation
Lists alternative products according to stock status
Apartment managers can generate a price quote online

Page refresh is required in the administration panel
In the video above is the area to add and edit Multiswitch product
There are separate pages for each product (Like a multiswitch page)
I want to refresh the page when the product is successful as a result of adding or updating (These are all done on their own page)

  1. My question is:
    Adding or editing products Should MySQL codes be on another page or on their own page?
    Which is correct?

Some of the problem with our attempt at understanding what you are trying to do, is due to the organization of the code on the page and the extra code trying to SELECT data to determine if it already exists before inserting/updating it.

Your code for any page should be laid out in this general order -

  1. initialization - define, require, create, … things your page needs, such as the session_start() statement, a database connection, configuration values, …
  2. post method form processing code - a post method form should be used for things that create/update data on the server or perform an action such as sending an email.
  3. get method business logic - get/create data needed to display the dynamic content on the web page.
  4. html document/template - using simple php code or an actual template system, produce the actual html document, using the data produced from the above sections of code.

At the end of the post method form processing code, item #2 on this list, is where you would perform a header() redirect to the exact same URL of the current page to cause a get request. This will clear any post data and cause the page to display the result of any inserted/updated information. If you want to display a one-time success message, store it in a session variable, then test/display/clear that session variable at the appropriate location in the html document.

Next, don’t SELECT data in order to decide if it already exists. By defining an appropriate unique index in your database table, you can just attempt to INSERT or UPDATE the data, then detect if a duplicate key error occurred to let you know if the data already exists.

In case it has not already been stated, you need to use a prepared query when supplying enteral, unknown, dynamic data values when a query is executed. While a prepared query adds one php statement per query, provided you use the much simpler PDO extension, this actually will simplify the sql query syntax.

The form and the form processing code should be on the same page. This simplifies all the code and allows you to display any user error messages when you re-display the form. It also allows you to re-populate the form field values/selections with the submitted data so that the user doesn’t need to keep reentering the same data over and over.

Procedures for adding or editing products are done on their own page
So, no need to redirect to another page, add or edit, back to page
Proposal Generating Video

For now, the script works fine
I try to do better from time to time (with your help)

The problem for now is the problem in the first message on this topic continues
Screen Video

Sponsor our Newsletter | Privacy Policy | Terms of Service