Passing Variable In URL - Not Working

$iframecontent = get_url('http://domain.com/data.ashx?id=270.126&sub_id=List5&gender=".$title."&firstname=".$first."&lastname=".$last."&email=".$email."&dob=".$dob."');

Morning Guys!

Hope you are all well, any reason why my variables are not being replaced with its value in the url?

Thank you.

Because you’re mixing up single quotes and double quotes.


$iframecontent = get_url('http://domain.com/data.ashx?id=270.126&sub_id=List5&gender='.$title.'&firstname='.$first.'&lastname='.$last.'&email='.$email.'&dob='.$dob); 

Also, you may want to [fphp]urlencode[/fphp] those parameters.


$iframecontent = get_url(
  sprintf(
    'http://domain.com/data.ashx?id=270.126&sub_id=List5&gender=%s&firstname=%s&lastname=%s&email=%s&dob=%s',
    urlencode($title), 
    urlencode($first),
    urlencode($last),
    urlencode($email),
    urlencode($dob)
  )
); 

(in the highlighted version you posted the string is all red, while the variables ~should~ be blue, that’s always a good clue to see you’ve screwed up the string :))

Thank you very much ScallioXTX :slight_smile: