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

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.