Author |
Message |
D11
Elite Baiter
Joined: 02 Jul 2006
Posts: 1702
|
Posted:
Tue Nov 27, 2007 1:46 pm |
|
Its driving me nuts.
im trying to create a php form, when the user selects an option the php changes dynamically and items on the form are changed.
the bits im not understanding is on some pages you click the page isnt refreshed, it will just change a portion of the code and thats what im trying to replicate, when a user says they would like information on 1 item there is no point asking do you want to know about all the other items, the form should change to item specific details.
I want it to leave the choices there, they might want to read about a different item, but from that point on it needs to dynamically change to different fields.
Any php people know how to do this properly? Also its using htmlspecialchars because that should stop people adding strange stuff and having the page do stuff its not supposed to do. |
_________________
1x 0x
Click here to support 419Eater.com
I make software that drives lads crazy. Thats my revenge on lads. (it all helps)
this transaction is 100 percent risk/hitch free - bobo
why no pay me - abum bello
because the cops will know it was you - me
ok this is good - abum bello |
|
|
|
Don
Baiting Guru
Joined: 25 May 2004
Posts: 3045
Location: Italy, 87.2.222.132
|
Posted:
Tue Nov 27, 2007 2:19 pm |
|
|
|
|
Tae
** REMEMBERED **
Joined: 27 Apr 2004
Posts: 507
Location: Austria
|
Posted:
Tue Nov 27, 2007 3:13 pm |
|
The only option I see is to have the fields on different sites. Depending on the user's choice call a different site, otherwise you have to use something like Javascript, like Don suggested. |
_________________ x3
"DO YOU LOVE ME?IF YES THEN CALL ME LETS MAKE LOVE ON THE PHONE." DR.CLIFFORD ANDERSON
Kill a bank a day! |
|
|
|
Rover
Site Admin
Joined: 13 Apr 2004
Posts: 16189
Location: North of the Limpopo
|
Posted:
Tue Nov 27, 2007 3:49 pm |
|
|
|
|
D11
Elite Baiter
Joined: 02 Jul 2006
Posts: 1702
|
Posted:
Tue Nov 27, 2007 8:34 pm |
|
@ rover yea, but some scripts allow whole css changes too, im thinking that has to be javascript.
I think ill end up having to use javascript to change the form bit, im no good at javascript.
I had a look at dons suggestion of ajax too, I am surprised its not an ability of php itself. |
_________________
1x 0x
Click here to support 419Eater.com
I make software that drives lads crazy. Thats my revenge on lads. (it all helps)
this transaction is 100 percent risk/hitch free - bobo
why no pay me - abum bello
because the cops will know it was you - me
ok this is good - abum bello |
|
|
|
MrMe
Master of Master Baiters
Joined: 09 Aug 2007
Posts: 593
|
Posted:
Thu Nov 29, 2007 1:10 am |
|
Php is purely a server side language, you can't run php within a browser, so there would be no way of php having that ability. All php does is output text. For all intents and purposes, the browser doesn't know or care whether it is receiving text outputted from a PHP script, or a static file.
You need to use Javascript. If you want to just update fields, so that for example with that car site, you chose Ford, then all the models will be Ford models - Javascript is all you need. If you want to be abit fancier, and get information from the server - say for example you wanted to do a postcode search, you would use AJAX to send the postcode to the server, and it would return the appropriate address. It all depends on what exactly you want to do.
Anyway, to change the stylesheet using Javascript:
In your HEAD section, put:
<link rel="stylesheet" href="css4.css"> // i=1
<link rel="stylesheet" href="css3.css"> // i=2
<link rel="stylesheet" href="css2.css"> // i=3
<link rel="stylesheet" href="css1.css"> // i=4
// Make sure the default one is last
<script language="JavaScript">
var doAlerts=true;
</script>
Then whenever you want to change, simple disable the current one:
document.styleSheets[i].disabled=true;
where i is the number of the spreadsheet you want to disable
and enable the other one using:
document.styleSheets[i].disabled=false; |
_________________ <a href="?t=120541">GIT Form</a> - <a href="?t=130670">Send emails in the past</a> - <a href="?p=1002914">3-stern Union</a>
<a href="?t=125626">MTCN S3cur3</a> Endorsements:
I am almost having a bad sight as a result of click on the box
my eyes are paining me now cos i have been
looking at the computer for more than six hours
you cannot subject me to this suffering
i am sick and tired of this shit.
I don't go with this Idea at all, this is not how business is done
whenever i make mistake even at the peak of retrieving the numbers i would ask to go back to the begining and this has virtually consumed all my time by doing this
i cant stress my self any more..I now have a back pain cos of this
|
|
|
|
leccy
Baiting Guru
Joined: 26 Sep 2004
Posts: 2036
Location: shithole in Scotland
|
Posted:
Thu Nov 29, 2007 6:17 am |
|
digital-one wrote: |
I had a look at dons suggestion of ajax too, I am surprised its not an ability of php itself. |
AJAX is what you want. Theres good AJAX tool kits which has it's own set of pre-defined functions written in php. So you add this php which you refer to by the examples and it parses as forms so saves you doing all the js work.
If you write alot of forms and makes it a whole lot simpler.
http://wiki.bluga.net/HTML_AJAX/HomePage |
_________________ Do not diss my jokes
|
|
|
|
|