Jump to content

Need help with a $_GET request


eldan88

Recommended Posts

Hey,

 

I am trying to pass in the $confirmation_method at the end of the /voice.php url, for this voice application API I that I am working on

 

However dreamweaver gives me a syntax error from the line number starting with the variable $call . I think I am not concatenating the code correctly after ?confirmation_method=

 

Any suggestions?

 

Thanks


if($_POST['telephone_keypad']) {
	$confirmation_method = $_POST['telephone_keypad'];
	

//The code below is for the telephone keypad
$call = $client->account->calls->create("+17185697116", "+13472734190","http://www.myurl.com/voice_demo/voice.php?confirmation_method="  . echo "{$confirmation_method}",array  ("StatusCallback" => "http://www.myurl.com/voice_demo/call_back.php"));
}
?>
Link to comment
Share on other sites

echo is for output only, and it's a statement not an expression (so you can't use it as if it returns a value or something).

"http://www.myurl.com/voice_demo/voice.php?confirmation_method={$confirmation_method}"
You really should be validating that $confirmation_method before you blindly stick it in a URL like that.
Link to comment
Share on other sites

echo is for output only, and it's a statement not an expression (so you can't use it as if it returns a value or something).

"http://www.myurl.com/voice_demo/voice.php?confirmation_method={$confirmation_method}"
You really should be validating that $confirmation_method before you blindly stick it in a URL like that.

 

 

 

Oh okay i see the mistake.

 

What do you mean by validating the $confirmation_method?

 

Aren't i doing that with the  if($_POST['telephone_keypad'])?

 

 

This is how my form looks like

Please Select what type confirmation method you would like to use:
<?php if(!empty($message)) {echo "<b>" . $message . "</b>";} ?>
<form action="confirmation.php" method="post">
Order Management <input type="radio" name="order_management" /><br />
Telephone Keypad <input type="radio" name="telephone_keypad" /><br />

<input type="submit" name="submit" value="submit" />


</form>
Link to comment
Share on other sites

Just because your form has it as a radio button doesn't mean it will contain the values you expect. Heck, I don't know what value you expect it to have in the first place. If it should even have one.

 

I'm sorry. I'm not to familiar with HTML. What is the use of adding a value in the radio fields?

Link to comment
Share on other sites

The way you have your form setup right now, a user could select both radio options. It's not an either/or choice which is typically what radio buttons are for. Give it a try for yourself, click the first radio, then the second radio. Both will be selected.

 

The way you are supposed to create radio groups is to give every radio button the same name, but a different value.

 

And, in the odd case you'd actually want the two radios to function separately as they do, you still either need a value or need to change your code to work based on the name. Since the radio's have no value currently, $_POST['telephone_keypad'] would either be an empty string or maybe 'on', not sure how the browsers would treat that.

Link to comment
Share on other sites

The way you have your form setup right now, a user could select both radio options. It's not an either/or choice which is typically what radio buttons are for. Give it a try for yourself, click the first radio, then the second radio. Both will be selected.

 

The way you are supposed to create radio groups is to give every radio button the same name, but a different value.

 

And, in the odd case you'd actually want the two radios to function separately as they do, you still either need a value or need to change your code to work based on the name. Since the radio's have no value currently, $_POST['telephone_keypad'] would either be an empty string or maybe 'on', not sure how the browsers would treat that.

Wow your are right. I have now added values to it.

 

I know  this is an amanuter question, but what conition should I use to validate $confirmation_method?

Link to comment
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.