Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php select page change

<?php
$page = null;
if(isset($_POST['page'])){
    $page = $_POST['page'];
}
switch($page){
    case 'page3': include_once('/path/to/page3content.php'); break;
    case 'page2': include_once('/path/to/page2content.php'); break;
    case 'page1': include_once('/path/to/page1content.php'); break;
    default: include_once('/path/to/defaultcontent.php'); break;
}
?>
<form name="myform" action="" method="post">
    <select name="page" onchange="this.form.submit()">
        <option value="page1"<?php if($page == "page1"){ echo " selected"; }?>>Page 1</option>
        <option value="page2"<?php if($page == "page2"){ echo " selected"; }?>>Page 2</option>
        <option value="page3"<?php if($page == "page3"){ echo " selected"; }?>>Page 3</option>
    </select>
</form>
Comment

php select page change

<select name="page" onchange="window.location=this.value">
    <option value="/path/to/page1.php">Page 1</option>
    <option value="/path/to/page2.php">Page 2</option>
    <option value="/path/to/page3.php">Page 3</option>
</select>
Comment

php select page change

<?php
$page = null;
if(isset($_POST['page'])){
    $page = $_POST['page'];
}
switch($page){
    case 'page3': include_once('/path/to/page3content.php'); break;
    case 'page2': include_once('/path/to/page2content.php'); break;
    case 'page1': include_once('/path/to/page1content.php'); break;
    default: include_once('/path/to/defaultcontent.php'); break;
}
?>
<form name="myform" action="" method="post">
    <select name="page" onchange="this.form.submit()">
        <option value="page1"<?php if($page == "page1"){ echo " selected"; }?>>Page 1</option>
        <option value="page2"<?php if($page == "page2"){ echo " selected"; }?>>Page 2</option>
        <option value="page3"<?php if($page == "page3"){ echo " selected"; }?>>Page 3</option>
    </select>
</form>
Comment

PREVIOUS NEXT
Code Example
Php :: wordpress throw to debug.log 
Php :: Limit Product Name in Magento2 
Php :: laravel php 8 ububtu 
Php :: Your Composer dependencies require the following PHP extensions to be installed: curl 
Php :: run laravel mix 
Php :: php ucwords 
Php :: how to add woocommerce cart counter 
Php :: php get environment variable 
Php :: disable block editor on widget section wordpress 
Php :: php chunk array 
Php :: Check if session exists or not in laravel 
Php :: how to return 0 as true in laravel 
Php :: get number of chars ina string php 
Php :: Allowed memory size of 1610612736 bytes exhausted 
Php :: Too Many Attempts. laravel error 
Php :: Creating a Basic Route in Laravel 8 
Php :: order number generate laravel 
Php :: concat and search in laravel eloquent 
Php :: count() parameter must be an array or an object that implements countable laravel 
Php :: php array join 
Php :: difference between fetch assoc and fetch array or object php 
Php :: show query in laravel 
Php :: laravel auth namespace 
Php :: php find substring 
Php :: slp price php 
Php :: Skip WooCommerce Cart page and redirect to Checkout page 
Php :: toarray php 
Php :: php get query string 
Php :: centos update php 7 to php 8 
Php :: sanitize_text_field 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =