Jump to content

Missing values in form action tag


md7dani

Recommended Posts

Trying to open a chart with form action tag and a url. I want to send values from submit form and use it in the url. I don't know if it's possible to pass the values to the form action tag from isset($_POST['Posted'])??  Ex code:

 

<form action="<?php echo 'http://chart.apis.google.com/chart?cht=lc&chd=e:nE98.g&chxt

=x,y&chxr=1,0,4000&chs=600x200&chl=October|November'; ?>" target="_self" method="post">

 

This works if it's static!

 

But I need it to be dynamic like this:

 

//if submit in form

if(isset($_POST['Posted']))

{

$data="e:nE98.g";

$month_arr[0]="October";

$month_arr[1]="November";

}//end isset form

 

<form action="<?php echo 'http://chart.apis.google.com/chart?cht=lc&chd=' . $data . '&chxt=x,y&chxr=1,0,4000&chs=600x200&chl=' . $month_arr[0] . '|' . $month_arr[1]; ?>" target="_self" method="post">

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

</form>

 

What's wrong with the code above, can't see why it's not working. Is it impossible to pass values to form action tag or is it something wrong with the url string?

thanks,

Link to comment
https://forums.phpfreaks.com/topic/184415-missing-values-in-form-action-tag/
Share on other sites

What on earth are you trying to accomplish? I'm not sure what you're doing. You're echoing an image into an action tag? Action was meant to link to something that processes a form, or a JS action. If you're wanting to input data into the image, than action should = $_SERVER['PHP_SELF']; and there should be <input/> tags for each data entry.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.