Reply to Re: How to modify CSS with PHP?

Your name:

Reply:


Posted by deko on 08/23/06 17:43

> I suggest googling for a quick PHP tutorial on forms.
>
> <select name=color onChange="this.form.submit()">
>
> Should do it.
>
> One last thing, in your PHP make sure the array you are accessing is
> the correct one. $_POST retrieves all variables that were submitted
> via form method=post, $_GET retrieves all variables that were submitted
> via form method=get [in the url: eg:
> domain.com?varname=varvalue&var2name=var2value]. $_REQUEST gets the
> variables either way, but should rarely be used.
>
> Also, as a beginniner you should take extra steps to debug your code.
> Add echo statements in your php script to make sure things are
> happening as planned... you'll catch a lot of bugs this way.
> var_dump() also comes in handy. In this script you should do
> var_dump($background) just to make sure that value is getting set
> correctly.
>
> Also, if you are interested, you can make a dummy form with lots of
> different controls, and have your php script do var_dump($_POST) to see
> how PHP populates the $_POST array based on a form's submission.

Thanks for the help, random.

The URL that needs to be reloaded (with the new background) looks like this:

http: / /www . example . com/ks042/?p=14#more-83

I discovered that I can echo the background variable using:

$background = trim($_GET['color']);

with this URL:

http: / /www . example . com/ks042/?p=14&color=white#more-83

The below form seems to work, except for the missing 'p' variable and #more
anchor:

<form name="bgcolor" method="get">
<select>
<select name=color onChange="bgcolor.submit()">
<option value=yellow>white</option>
<option value=white>yellow</option>
</select>
</form>

If the URL did NOT contain any variables or anchors, would this be the correct
way to construct the form?

How do I do it with a URL with variables?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация