Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 HELP me pls with Radio Buttons & Submit Form

Author  Topic 

slavic
Starting Member

2 Posts

Posted - 2004-10-24 : 16:25:58
Please tell me how to send a data info to database and after what if is checked express radio button to redirect to page1.php and if is checked standard radio button to redirect to page2.php


<FORM ACTION="add_url.php" METHOD="post">
<INPUT type=radio disabled value=express name=submission>
<INPUT type=radio CHECKED value=standard name=submission>
<INPUT TYPE="submit" VALUE="Submit" CLASS="BUTTON">
</FORM>

Thanks

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2004-10-29 : 15:22:32
What you're asking for is PHP code, which is not really our specialty here. Sending the data to the database is simply a matter of establishing a connection and executing a SQL statement. I don't know PHP, but in ASP, there is an ADODB Connection object that can be used for this. This code would go in your add_url.php page because that's where everything is being sent when the form is submitted. Then in your add_url.php page you would query the form contents and use PHP code to redirect to whatever page you want. Again, in ASP there is an object called Request and it has a collection called Form (i.e. Request.Form) that contains the contents and you can process what's there to determine which radio button was selected and what actions to take.

Sorry I can't help you more. Check a PHP-specific site if you need additional help. And if you need help with the syntax of the SQL statement (assuming you're using a Microsoft SQL Server database) we'd be glad to help you some more.

-----------------------------------------------------
Words of Wisdom from AjarnMark, owner of Infoneering
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-10-29 : 16:47:56
Here's pretty much everything on PHP:

http://www.php.net/manual/en/
Go to Top of Page

Knarf180
Starting Member

42 Posts

Posted - 2004-10-29 : 17:02:05
Bah, you guys are so mean.. He has to learn somehow.
The code below is not certified bug free. Its a quick example and time for me to leave the office. Yay friday!

// Connection Settings
$mysql_database="DATABASE_NAME";
$mysql_username="USER_NAME";
$mysql_password="USER_PASSWORD";
$mysql_server="DATABASE_SERVER";

//In case you dont have registered globals turned on you need to grab the data
$submission = $_POST['submission'];

// This will establish the connection and store it in $link
$link = mysql_connect($mysql_server,$mysql_username,$mysql_password) or die ("Unable to connect to SQL server");
$result = mysql_query("insert into TABLE_NAME (FIELD1_NAME) values $submission

//Everything is done now so redirect the user
if ($submission == 'express') {
header("Location: page1.php");
} else {
header("Location: page2.php");
}
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-10-29 : 17:23:20
Well, we COULD'VE posted code if we actually knew any PHP.
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2004-10-29 : 17:39:50
Yeah, what Rob said! And Hey, I come along after nobody has posted an aswer for 5 days and I at least gave him some key words to use in searching for help... And I didn't blast him for posting a PHP question on a SQL Server site. I was trying to be diplomatic and helpful. So there!

-----------------------------------------------------
Words of Wisdom from AjarnMark, owner of Infoneering
Go to Top of Page
   

- Advertisement -