HTML question

anuj_web

New Member
Messages
145
Reaction score
0
Points
0
Hi,

I have 2 combo's in my form....Th second combo values varies according to that selected in the first combo..like whne u select a country the states in it are listed in another ....

how can this be done ??

I also want to ask how can i make my form look better without the use of CSS ??
Border or something possible ??

thnks
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
The easiest way would be to use javascript to dynamically hide and show sections of your form.
If you look on a script database (e.g. Dynamic Drive, Hotscripts) you should be able to find a script that does what you want.
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
There's a few ways to a new list to load depending on what's selected in the first list. You could have the page reload when the user selects a different option and add the selection to the url(e.g., something.php?selection=value). However, if you want to avoid reloading, then you could use an ajax system to retrieve the data from the server more discreetly. But if the lists aren't so large that they would impede page loading time significantly, then I would suggest making them invisible and displaying the relevant one when the user changes the first selected option since this is instantaneous.

And as for how to make your form look better, I think you should provide a link to it so people can make suggestions based on your current layout. Why don't you want to use css, by the way?
 

anuj_web

New Member
Messages
145
Reaction score
0
Points
0
Actually ,I am learning PHP and have quite a bit job to finish b4 the end of this month

so can't put my hands into everything....

neway thanks for replying...

Can u tell me how to send email from our servers using PHP code

thanks
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
A reminder: You need to request for a upgrade to Intermediate PHP for the mail() function to work.
 

anuj_web

New Member
Messages
145
Reaction score
0
Points
0
How can I have two submit buttons in the same form

submitting to two different php files??

I use this code..it is not working
Actually ,i generate the html page containing this code using PHP
Code:
<input type="submit" id="Button1"" name="Button2" value="UPDATE" style="position:absolute;left:27px;top:599px;width:75px;height:24px;z-index:17" Onclick="document.frmdp.action='Update.php'">
<input type="submit" id="Button2"" name="cp" value="Change Password" style="position:absolute;left:132px;top:599px;width:153px;height:24px;z-index:18" Onclick="document.frmdp.action='Change_Password.php'">



I got it to work by using JS

Code:
<input type="submit" id="Button1"" name="updt" value="UPDATE" style="position:absolute;left:27px;top:599px;width:75px;height:24px;z-index:17" Onclick="chktype(this)">
<input type="submit" id="Button2"" name="cp" value="Change Password" style="position:absolute;left:132px;top:599px;width:153px;height:24px;z-index:18" Onclick="chktype(this)">


function :
Code:
function chktype(ctrl)
{
var mySelect = ctrl.name ;
if (mySelect=="updt")
{
document.frmdp.action="Update.php" ;
}
else
{
document.frmdp.action="Change_Password.php" ;
}
}
 
Last edited:

LHVWB

New Member
Messages
1,308
Reaction score
0
Points
0
You can use some simple javascript in the submit button to change the forms action. Here is an example.

HTML:
<form id="form" method="post">

<input type="submit" value="Submit to test.php" onclick="javascript:getElementById('form').action='test.php';"></input>
<input type="submit" value="Submit to test2.php" onclick="javascript:getElementById('form').action='test2.php';"></input>

</form>

Edit: I didn't see your example, here is you code edited to make it work. All I have done is replace the frmdp with getElementById('frmdp').

Code:
<form id="frmdp" method="post">

<input type="submit" id="Button1" name="Button2" value="UPDATE" style="position:absolute;left:27px;top:599px;width:75px;height:24px;z-index:17" Onclick="document.getElementById('frmdp').action='Update.php'">
<input type="submit" id="Button2" name="cp" value="Change Password" style="position:absolute;left:132px;top:599px;width:153px;height:24px;z-index:18" Onclick="document.getElementById('frmdp').action='Change_Password.php'">

</form>
 
Last edited:

marshian

New Member
Messages
526
Reaction score
9
Points
0
I don't think it's possible, but there is always a solution!
You have to name your submit buttons so you can see what button the user used. Then in your php, you can get that information with $_GET["submit"] or $_POST["submit"], depending on what you chose.
Edit:
You can use some simple javascript in the submit button to change the forms action. Here is an example.

HTML:
<form id="form" method="post">

<input type="submit" value="Submit to test.php" onclick="javascript:getElementById('form').action='test.php';"></input>
<input type="submit" value="Submit to test2.php" onclick="javascript:getElementById('form').action='test2.php';"></input>

</form>

Good point, that should work indeed, but I think my way is better because the user can disable javascript, but he can't do anything about php :p
 
Last edited:

anuj_web

New Member
Messages
145
Reaction score
0
Points
0
Hi

@verbsite your method is smaller
I tried it

But I use PHP to generate the page..... an error is popped mayb because of the single quote used......

@marshian
thanks for your reply bro

thanks a ton
 
Last edited:
Top