md7dani Posted December 8, 2009 Share Posted December 8, 2009 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, Quote Link to comment Share on other sites More sharing options...
forumforme123 Posted December 9, 2009 Share Posted December 9, 2009 I took out the If statement, and it works on my computer. Why do you need the If statement? Quote Link to comment Share on other sites More sharing options...
oni-kun Posted December 9, 2009 Share Posted December 9, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.