Click to See Complete Forum and Search --> : FORM problem + other problems


jericho
08-11-2003, 07:23 AM
I posted this in HTML section, but it was suggested I move it to PHP section. If someone could help, I'd be grateful.
------
I have a couple of problems, perhaps you could help me and post some helpful tips. Thanks


Problem 1. I use a html Form tag, which I use to get data from user and writing them in a database (using php) in MySQL. My Form tag looks like this:

<form action="poly_k.php" method=post>
<input type="text" name="polyvol" size="4" maxlength="4">
<input type="submit" value=" Buy ">
</form>

Everything up to this point works fine. File poly_k.php takes care of the writing into database actions.

Now, I'd like to use data which I enter into the window <input...> use in 2 ways, depanding which button I press. In other words, I'd like to have a "Buy" submit button and "Sell" submit button and they would both use data from one input window. How do I do that?

Is the following correct? (I suspect not...)

<form action="poly_k.php" method=post>
<form action="poly_s.php" method=post>
<input type="text" name="polyvol" size="4" maxlength="4">
<input type="submit" value=" Buy ">
<input type="submit" value=" Sell ">
</form>

How do I do that?


Problem 2. I use frames. Now, 'd like to click a link in one of the frames and I'd like it to modify the contents of the other frame, whichout changing the current frame. How do I do that?


Problem 3. I have a picture, which I use as a link (.jpg or .gif file). Now, I'd like this picture to have a couple of areas and depanding which area I click, I go to a different link (different URL). How do I do that? Do I have to use javascript for that?

If you can help me and post, please do.

Thanks,

Jericho

pyro
08-11-2003, 07:35 AM
#1: You will want to do this all with one PHP file. You can check which button was pressed, and then complete the desired actions. Change you form to look something like this:

<form action="poly_k.php" method="post">
<input type="text" name="polyvol" size="4" maxlength="4">
<input type="submit" name="buy" value=" Buy ">
<input type="submit" name="sell" value=" Sell ">
</form>

Then, in the PHP, you can check like this:

if (isset($_POST["buy"])) {
#Buy was clicked
}
else {
#Sell was clicked
}

#2 and #3: http://forums.webdeveloper.com/showthread.php?s=&postid=79831#post79831

jericho
08-11-2003, 07:49 AM
Great! Great! Great!

Thanks a lot!!! I will check that and see if this work right away.

It's great to have some helpful people around. :) :)

pyro
08-11-2003, 07:49 AM
Happy to help...

jericho
08-11-2003, 08:06 AM
FYI, I tried that and it works. PHP command 'isset' seems to do the job, so I'm a happy man. :)

Now let me get down to #2 and #3. :)

DaiWelsh
08-12-2003, 07:06 AM
For #2 use <a href="...." target="framename"> to direct the output of the link to a particular frame.

For #3 investigate the <map> html image map tag which allows you to define different behaviour for different areas of an image.

pyro
08-12-2003, 08:50 AM
#2 and #3 had been answered at http://forums.webdeveloper.com/showthread.php?s=&postid=79831#post79831

jericho
08-12-2003, 09:18 AM
Thanks, guys. I'm now fine both with linking to different frames and html map tag. Thanks!

Just one more question about frames. I can move the size of the frames in my browser by dragging with the mouse. How can I disable this? In other words, how can I freeze the size of the frame?

pyro
08-12-2003, 09:20 AM
Add noresize="noresize" to the frame that you do not want to be able to resize.

jericho
08-12-2003, 11:14 AM
Thanks! Works alright.

pyro
08-12-2003, 11:15 AM
You're welcome... :)