Php redirect, not working [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I have a form with an add user button. If the user is added, the page should redirect to another page which would allow you to edit that user.
What I currently do is:
if ($user_added) {
<META HTTP-EQUIV=refresh CONTENT='0;
URL=<php echo $root. "Path1/path2/path3/userEdit.php?ID=".$newUser->GetID(); ?>'>
NOTE: ID is not something you can switch to easily, its a different more complicated number that i generate randomly whenever I add users, for the sake of the question i kept it simple.
UPDATE: This changes the page to the userEdit page but it does not load the data from the new user.

You are mixing html and php. PHP redirects can be done with a header BEFORE the page loads like so:
<?php header('Location: http://mywebsite.com/index.php'); ?>
But again this only works if the content has not yet been sent.
Also:
URL=<php echo $root. "Path1/path2/path3/userEdit.php?ID=".$newUser->GetID(); ?>'>
This is also insecure because any user can access any user's page simply by changing the url.

Related

Replace PHP with text [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have some PHP that displays the users session name in the HTML and if the user is not logged in, then I would like it to display "User" instead.
Can I have an if statement in this case? I tried it myself but I got header errors.
This is what I've tried so far but each practical attempt just spits out more errors at me.
This is a different approach I have tried.
<?=$_SESSION['sess_user'] or ("User");?>!
<?php echo (isset($_SESSION['sess_user']) ? $_SESSION['sess_user'] : "User"); ?>
This will check if the session is set, if it is then echo the session, if it isn't then it will echo "User".

How do I get information from this page, that isn't in the HTML code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
http://www.aliexpress.com/item/NEW-7-Android-2-3-256MB-DDR2-4GB-NAND-Flash-7-inch-tablet-pc/498159194.html - I got this link
Here you can see a buttons: bundle, color
If you click some of them the price will change, but the question is how can I parse that behaviour to my page via php?
The problem is that I can't understand where is javascript code that executes this, or how to find it, maybe someone got ideas about that?
Inspecting that page's source code I can see that the skuProducts variable in javascript contains this information encoded into a JSON-string. You can't really run this javascript code on your webserver, so you'll have to devise another way to get that variable's value - and then you can use json_decode() to get the contents.
Note that changing the amount of items results in an AJAX call to a shipping costs calculator. You could probably simulate that, but I'm not sure that webshop would like that (and it might be illegal).

Referring to an id from url on a php page [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a page /home/practice.php . On the page, i have elements with assigned id's. I want to refer to the elements . For example, practice.php/#footer , but all the content from the page disappears and i get a blank page . Even if i just put a slash, i.e practice.php/ , nothing shows up on the page.
This entirely depends on how you've set your page up, but just as with any HTML page you should be able to refer to:
page.php#anchor
Where anchor refers to an id within the page.
Note the lack of / before the #
Your file is practice.php. Placing a / at the end will make your browser treat practice.php as a folder instead. If you want to use #footer in your URL, simply use practice.php#footer.

global header.php not displaying a certain image on random pages [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I'm working on a website that was originally built using codeigniter. It's a mess on the back end and there's no identifiers to anything really. I've recently changed a banner (header.php) and edited the style to fit as required. I added a simple img source= and a href= into the header.php and it seems to be displaying fine on the homepage. However once I navigate away to other pages the img source isn't displaying whilst all my other changes are?
The a href link remains with the class but the image is displaying as broken.
I've checked all the locations etc and it's all pointing to the correct place?
Any ideas?
I understood that you have given relative path to your image directory. You have to prepend base_url in src tag as follows
<img src="<?php echo base_url('/path/to/image.jps');?>" alt="Image"/>

how do i force a user to go back twice on a mobile web page using php or javascript without the user clicking any link or button [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
how do I force a user to go back twice on a mobile web page using PHP or jAVASCRIPT without the user clicking any link or button.
something like using history.back() without a user having to click on anything
In javascript
function goBackTwice()
{
window.history.go(-2)
}
You may want to look into https://github.com/browserstate/history.js/ for a more robust client side solution.

Categories