Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a MySQL query which will return a module code from the database. Let's say I have a template file (i.e. course.php) and what I would like to achieve is that I want to create a dynamic page with the name of the module code returned by the query (i.e. course.php?course=CS1231). However I don't have a submit button in course.php which allows me to pass that variable using GET method into URL. How can I achieve that?
AFAIK you don't need a submit button to use $_GET if your URL looks like this course.php?course=CS1231
You can just redirect to the page e.g.
<?php
$variable='course.php?course=CS1231'; #Whatever is returned by your database
header('Location: http://www.example.com/'.$variable);
exit;
?>
And in course.php you use $_GET['course'].
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am trying to make this page:
https://mediastreet.ie/media-jobs/role-65678
same as this page using htaccess:
https://mediastreet.ie/media-jobs/role
So basically /role-65678 is a parameter like role-{parameter}. So when on /role-65678 i have a script that fetches this (65678) and displays the job according to it.
Rather than editing your htaccess file, I would just reccomend sticking with a good old get method.
Use https://mediastreet.ie/media-jobs/role?id=65678
Then in the index.php file in the directory "role", use the get functionality as shown below.
<?PHP
$id = $_GET["id"];
//Code to follow
?>
Past experiance tells me this will save alot of htaccess headaches!
All the Best.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a PHP script which invokes another PHP script thru header("Location:"). Is it possible to pass some data to that second script, e.g. login name. That second script uses POST as its form's method. Currently I pass data thru file on server
As this basically just redirects the browser to the url specified in your Location header you can not simulate a POST request here.
What you can do is to send GET-parameters with the requets.
For example you could do this:
<?php
header("Location: nextpage.php?login_name=".$login_name);
Then you would access this in the nextpage.php code with $_GET['login_name'].
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to create a simple site for local test, but I need to show on URL the following:
?id=1
How can I do it?
You can do this by hyperlink, form submit, manually typing it into the URL bar and many other methods. Use a hyperlink:
ID1
Im not too sure what you are asking, but if you are looking to add an id variable to the URL you need to add it to the URL when you redirect
EX.
From link
Link
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a scenario here in which I am confused to solve. So here is the matter,
I have a PHP page with the project selector that gives the value into monitorIndex.php
And in the monitorIndex.php im using that given value with this
if(isset( $_POST['cd-dropdown'])) $_SESSION['cd-dropdown'] = $_POST['cd-dropdown'];
in which I use $_POST['cd-dropdown'] as the value used everywhere
now my question is, when user click on the navigation menu to go to a page called monitorTable.php, how do I still use the $_POST['cd-dropdown'] ? and how to make variable alive when user navigate out from that page and go back to monitorIndex.php and keeping the $_POST['cd-dropdown'] alive
thank you so much
You can use the
$_SESSION['cd-dropdown']
since it was assigned.
it will only destroy if session_destroy is invoke.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am updating 100,000 records. So the page looks blank while the update query process runs on the backend. Can someone tell me how to display the text "Please wait blah blah" until the update ends?
Well depending on your script and the structure, the easiest way would be to change a div's css property called display. When a user clicks on a link that starts the php script, you could add a javascript code like :
$(#+THEIDOFYOURDIV).show("slow");
});
and once its done, you can call another js function to close it like :
$(#+THEIDOFYOURDIV).hide("slow");
});
*NOTE I am using jquery functions, so you would need to include jquery in your pages.
There is another way you could do this using php ONLY, I had the same issue so take a look at this: how to show results while a php script is still running