The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Colleen (12) [Avatar] Offline
#1
How do I retrieve server side parameters in php?

I know that it is $xxx = Request.Form('q') in asp and
$xxx = Request.params.GET["q"] in C
but what is it in php?

In my doubleComboXML.php to retrieve a parameter I use....

$xxxx = $_POST['q'] but $xxxx comes out null. If I hard code this value everything works! ...expect of course the second pick list always has the same values.

Thanks guys.
kurinosuke (156) [Avatar] Offline
#2
Re: Double Combo: Trouble implementing in php
If you've sent a GET request, you will use $_GET['q'], not $_POST['q'] which, as its name says, for POST requests.
Colleen (12) [Avatar] Offline
#3
Re: Double Combo: Trouble implementing in php
Thank you.

I thought I was getting that variable correctly and I am. I am passing it with a "POST". Something must be going wrong elsewhere!
kurinosuke (156) [Avatar] Offline
#4
Re: Double Combo: Trouble implementing in php
>Something must be going wrong elsewhere!
Yes. Check that you're actually sending it as a POST, and check the content of the request (especially that 'q' is in the request)
Pascarello (208) [Avatar] Offline
#5
Re: Double Combo: Trouble implementing in php
I recommend using Firebug with Firefox to see if you posted anything: http://radio.javaranch.com/pascarello/2006/09/13/1158158516682.html

Eric
nisus (8) [Avatar] Offline
#6
Re: Double Combo: Trouble implementing in php
Hiya,

I'm a newbie at this. Trying to use the DoucbleCombon with PHP. Has anybody written this example in PHP per chance, or can somebody help me along to understand how to do it?

Geert
Brussels
nisus (8) [Avatar] Offline
#7
Re: Double Combo: Trouble implementing in php
Cna someboyd talk me trough?

First thing I'm doing I guess is change this in Listing 9.2:
var url = "DoubleComboXML.php";
nisus (8) [Avatar] Offline
#8
Re: Double Combo: Trouble implementing in php
Second thing, how do I build up the DoubleComboXML.php?

Beyond me...
nisus (8) [Avatar] Offline
#9
Re: Double Combo: Trouble implementing in php
I'll start like this...

<?php <br /> header("Content-type: text/xml"smilie;
echo("<?xml version='1.0' ?>
");

$host = 'localhost';
$user= xxxxx
$pass = xxxx
$dbname = xxx

$link = mysqli_connect($host, $user, $pass, $dbname)
or die(mysqli_error());

strQuery = $_POST['q'];
strForm = $_POST['f'];
strElem = $_POST['e'];
nisus (8) [Avatar] Offline
#10
Re: Double Combo: Trouble implementing in php
Little change:

$strQuery = $_POST['q'];
$strForm = $_POST['f'];
$strElem = $_POST['e'];
nisus (8) [Avatar] Offline
#11
Re: Double Combo: Trouble implementing in php
Then (adapted to my db):

$query = "SELECT * " .
"FROM regions " .
"WHERE cont_id = '$strElem' " .
"ORDER BY id";

$result = mysqli_query($link,$query)
or die(mysqli_error());

$myrow = mysqli_fetch_array($result)
or die(mysqli_error());
nisus (8) [Avatar] Offline
#12
Re: Double Combo: Trouble implementing in php
Can anybody help me beyond this point?
nisus (8) [Avatar] Offline
#13
Re: Double Combo: Trouble implementing in php
I figured it out with the help of Colleen! Thx