Jump to content

Recommended Posts

hi guys ive just finished this task after hours of head scratching

 

since svg is only really supported good in firefox and opera ive chosen firefox as my browser to view this url

 

www.deansignori.com/phpsvgpie/index.php

 

i do need more help with this task but a different problem (creating select box to call different stylesheet and to change from 2d - 3d

 

i have the code set out so that i can explode any segment or change size of slices or change from 2d-3d but i have to do this manually in the code to render different piecharts im wanting to use 1 but change it using a select box and echo my variable into it

 

basically im unsure of the syntax for this problem

 

psuedo code for style maybe something like

 

if select box value isset onchange stylecolour

echo stylecolour

if select box value isset onchange stylegrey

echo stylegrey

 

and for 3d-2d

 

if select box value isset onchnage format3

echo format3

if select box value isset onchange format2

echo format2

 

this would be on my index page

 

can anyone advise me please 

 

regards

Dean

 

Link to comment
https://forums.phpfreaks.com/topic/228023-php-select-box/
Share on other sites

You will need to use a form, obviously.

 

Now I'm assuming that the lines saying "if select box value isset onchange stylecolour" is just your way of saying which drop down option has been selected?

 

What you would do it this:

//Have a form on your page that has an empty action (it will refresh with the same page)
//At the top of your page you will have code to check if a form has been submitted, like this:
if(isset($_POST["submit"])){
//Then you can do your checking of the drop downs like this
if($_POST["drop_down_1"] == "styleColour"){
  echo "styleColour"; //This will be echoed into your header where the style sheet is, changing which style sheet is loaded.
}else{ //you can add else if, however if there is only two options, and one of the options have to be picked, the extra condition isn't needed
  echo "styleGrey";
}
}

 

It will be very similar above for the 2d/3d changing, just checking that corresponding drop down instead.

 

Hope that helps

 

Denno

Link to comment
https://forums.phpfreaks.com/topic/228023-php-select-box/#findComment-1175933
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.