Jump to content

s4salman

Members
  • Posts

    84
  • Joined

  • Last visited

Everything posted by s4salman

  1. Hi, I am using this code, what i want is to random fill up stepa field with either option a or option b every time i refresh the page, any help is highly appreciated!: <form action="myc.php" method="get"> <label for="element_1"> </label> <div> <select class="element select medium" name="stepa"> <option value="" selected="selected"></option> <option value="option a" >Advanced Human option a</option> <option value="option b">Advanced Human Option b</option> </select> </div> <br> <input type="submit"> </form>
  2. Can you please identify the line which is creating the issue. I am not able to figure out your point of view. Thanks
  3. Here the whole file attached herein <?php $host_name = "localhost"; $database = "s4salman_jag"; // Change your database name $username = "s4salman_jag"; // Your database user id $password = "jag001"; // Your password //////// Do not Edit below ///////// try { $dbo = new PDO('mysql:host='.$host_name.';dbname='.$database, $username, $password); } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die(); } ?> <?php if( $_GET["stepa"] || $_GET["stepaa"]|| $_GET["stepaaa"] || $_GET["stepaaaa"] || $_GET["stepaaaaa"]|| $_GET["stepaaaaaa"] ) { echo $_GET['filename']; echo "<br/>"; echo "0&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"; echo $_GET['description']; echo "<br/>"; echo "1&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"; echo $_GET['stepa']; echo '&nbsp'; echo $_GET['stepaa']; echo '&nbsp'; echo $_GET['stepaaa']; echo '&nbsp'; echo $_GET['stepaaaa']; echo '&nbsp'; echo $_GET['stepaaaaa']; echo $_GET['stepaaaaaa']; echo "<br/>"; <body> <form action = "<?php $_PHP_SELF ?>" method = "GET"> <input type = "submit" /> <table border="0"> <tr> <td width="100%" ALIGN="CENTER"> file name<input type="text" name="filename"> </td> </tr> <tr> <td width="100%" ALIGN="CENTER"> description<input type="text" name="description"> </td> </tr> </table> <table border="0" cellpadding="2" cellspacing="8"> <tr> <td width="10%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial order by field1"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field1]>$row[field1]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> <td width="20%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial order by field2"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepaa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field2]>$row[field2]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> <td width="10%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepaaa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field3]>$row[field3]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> <td width="10%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial order by field4"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepaaaa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field4]>$row[field4]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> <td width="20%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial order by field5"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepaaaaa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field5]>$row[field5]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> <td width="10%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepaaaaaa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field6]>$row[field6]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> </tr> </table> </body> </html>
  4. This code is only printing the 1st part of the field 6. For example if field 6 has data an oval, so it shows up an oval in the drop down list, But when i submit this form, only an gets printed on the next page. It is not printing whole an oval on the next page what is wrong with the code. Pls help! <?php $sql="SELECT * FROM tutorial"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepaaaaaa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field6]>$row[field6]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?>
  5. I want to repeat this form 40 times. Can any body help me with php code. Below, is the one row printing 06 drop down list. I want to repeat this thing 40 times. What is mean is that repeate this 06 drop down field 40 times. <tr> <td width="100%" ALIGN="CENTER"> description<input type="text" name="description"> </td> </tr> </table> <table border="0" cellpadding="2" cellspacing="8"> <tr> <td width="10%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial order by field1"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field1]>$row[field1]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> <td width="20%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial order by field2"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field2]>$row[field2]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> <td width="10%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field3]>$row[field3]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> <td width="10%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial order by field1"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field1]>$row[field1]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> <td width="20%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial order by field2"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field2]>$row[field2]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> <td width="10%" ALIGN="CENTER"> <label for="element_1"> </label> <div> <?php $sql="SELECT * FROM tutorial"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field3]>$row[field3]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> </div> </td> </tr>
  6. Got it to work as: <?php $host_name = "localhost"; $database = "s4salman_jag"; // Change your database name $username = "s4salman_jag"; // Your database user id $password = "jag001"; // Your password //////// Do not Edit below ///////// try { $dbo = new PDO('mysql:host='.$host_name.';dbname='.$database, $username, $password); } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die(); } $sql="SELECT * FROM tutorial"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ echo "<select name=stepa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field1]>$row[field1]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?>
  7. Anyone could help me out? Drop down list is not populating from mysql table, i could not figured out what is wrong in it. <?php $dbhost = 'localhost'; $dbuser = 's4salman_jag'; $dbpass = 'jag001'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT * FROM tutorial'; mysql_select_db('s4salman_jag'); $retval = mysql_query( $sql, $conn ); echo "<select name=stepa>"; // list box select command foreach ($dbo->query($sql) as $row){//Array or records stored in $row echo "<option value=$row[field1]>$row[field1]</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?>
  8. I am getting Parse error, i am confused what is wrong. Any one can guide me? Thanks cd.php
×
×
  • 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.