Jump to content

[SOLVED] the power of ACTION


zeem

Recommended Posts

how much power does <form ACTION= > have?

is it only for sending the form somewere? or can i use that to acess a server? like i have a table of variable items, i check the ones i want and click my submit button, can i use the action sub tag to access mysql database and input them in there?

 

z

Link to comment
Share on other sites

well thats very helpful, very helpful indeed. i may be too young for php, but that is besides the point. i ran through the tutorial, went to a few websites, did that whole thing. even finished a book  "How to do eveything with PHP & MYSQL" by i think "Vikram Vaswani". im just a kid tryign to learn; and instead of spending hours searching through these forums and other websites, i could also ask for help from some people here. if you think im a loser and shouldnt post here, thats your perogative. but dont post and proclaim how im too young and shouldnt bother the grown ups with such easy questions, when im sure you were in my position before. And i know im not a nuscence cause searching down the forums, there are some that i could answer, you know me being to young and all, so i know you guys dont hate people who are "noobies" at programing. but if you feel i should leave and never return, thats fine. but does anyone have an real answers that might help me?

Link to comment
Share on other sites

ops did I said something make you feel so hard? I apologize if I did.

Im actually giving you advises. If you done so and did't get any solution, then fine I will guide you here.  :)

 

You need a php file to get all these form field. After you get all these fields, you can now connect to your database and select the appropriate database and put in all the data into your table called 'ORDER'.

 

Refer here for how to forms work on PHP:

http://www.tizag.com/phpT/forms.php

and

http://www.w3schools.com/php/php_forms.asp

 

If you are using MySQL database, refer here:

http://www.freewebmasterhelp.com/tutorials/phpmysql

 

And still you need to refer to the article and tutorial. Hahaha. Gotcha...

 

Ran away.....................

Link to comment
Share on other sites

You are too young for PHP. Find some tutorial and articles on the web.

Let's make sure that we're focusing on helping them with specific guidance rather than simply making comments that could be taken as a personal attack... that's what we're here for, after all ;)

 

does anyone have an real answers that might help me?

Hopefully this will help some: the action of the form is parsed by the HTML interpreter, not by the server, so there is nothing dynamic (such as running insert queries) that can be done in that value itself. However, what you are asking about is one of the foundations to PHP: how do you handle a form submission and properly insert data into the DB? You need to have a script written that does receive the data (via the POST or GET method) from the form. Once you have that data retrievable, you point the action of your form to that page to receive the form submission. Here is a very basic example:

 

Page 1 (sender):

<form name="myTestForm" action="page2.php" method="post">
Name: <input type="text" name="name" value="" /><br />
Age: <input type="text" name="age" size="4" value="" /><br />
<input type="submit" name="submit" value="Go!" />
</form>

 

Page 2 (receiver):

<?php
if (isset($_POST['submit'])) {
  // form has been submitted
  $name = trim($_POST['name']);
  $age = trim($_POST['age']);
  echo "Hello, $name, you said you are $age years old!";
} else {
  // redirect to form since it hasn't been submitted
  header("Location: page1.php");
  exit();
}
?>

 

Hope this helps your understanding some. Once your second page has the values, you can insert them into a database instead of echoing them to the screen.

 

Good luck!

Link to comment
Share on other sites

OH you got me, i read the article. some helpful stuff there. fixed some things but this is my main concern,

 

i have an input secion

<input type=checkbox name =<?echo $shoe?>>

now im useing a variable because what i did was populate the page with sql/php. i used the whole $connection stuff. how do i translate that variable to a new page? i have the checkbox, you click submit, the new name for that check box depends on what item the person wanted and the new page will show wat they checked. should i not use $shoe for the name of the input? cause when i use it, it doesnt show anythign.

and im sorry for snaping, i did take a bit defense, but man this arizona green tea energy drink taste HORIBLE

Link to comment
Share on other sites

hmmm ok...but that exact varialbe corrisponds to the populated table, pulled from mysql database. i cant make it shoe[] because $shoe is that shoe thats in the table, thats just been inputed.

 

Huh?? ??? Don't get what you mean. Why not you explain what you want?

Link to comment
Share on other sites

OK wat i have so far is a table that is linked to the mysql database 'Archive'. the php runs down the table 'inventory' printing out the items in the column 'Name'. i also have a little check box next to each row in the table(in the html). wat i want to do is have the useer click the check box, and hit submit. it then goes to the shoping cart were the item that was checked is displayed, along with its price and and the subtotal and the total, with tax. the issue i am having is that the value of the checkbox is a variable, not somehign like 'shoe', but rather the '$shoe' that was taken from the mysql table. so wat i would do is output there discision to a different table order, from which the shopping cart will pull its data.

 

  this is all so that if i add a new inventory item, it will autamaticaly display the item and work with out me having to change the code.

 

i just had the idea, while typing this that it would be

 

<input type=checkbox value=<?echo $shoe?> name ='shoe'>

 

im new to this so i have some trouble with explaining...i think thats readable.

z

  im gonna test that. is that it, or is there a better way?

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.