Jump to content

Leftfield

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

About Leftfield

  • Birthday 09/04/1990

Contact Methods

  • Website URL
    http://novtel.co.za

Profile Information

  • Gender
    Male
  • Location
    South Africa

Leftfield's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all ok i have a button like so <input id="Submit" style="display:none;" type="submit" name="submit" value="<?php echo "Check"; ?>"/> now when i click the button it goes trough conditional logic like so <?php if(isset(if(isset($_POST['submit'])) { // Do my stuff } if(Somecondition) { //Do my next button clicked stuff } ?> Ok now after this i need to change button text and when its clicked again it should do the next conditional logic Does anyone now what is the best method for this ... Thanks
  2. Thanks Im done with PHP. Sorry to say im not impressed
  3. How to find the name value using php or $_GET here is the url header("Location:http://localhost:8666/OnlineBookingsPhp/index.php?name=Next"); Thanks
  4. Ok here is the code it runs on button click What i want to do is chage the uri on button click <form action="<?=$_SERVER['PHP_SELF'];?>" method="post"> <?php /* * Created on 2011/02/01 * Created by Marinus */ //Step 1 date validation// if(isset($_POST['submit'])) { $startDate = strtotime($_POST['startdate']); $endDate = strtotime($_POST['enddate']); if($startDate != false && $endDate != false){ $startDate = date("Y-m-d",$startDate); $endDate = date('Y-m-d',$endDate); SetDates($startDate,$endDate); } else { echo "Please select both dates!"; } } function SetDates($start,$end){ $connection = mysql_connect('*****', '*****', '******') ; mysql_select_db('OnlineBookings'); $query = //Hidin $result = mysql_query($query); $nonAvailableRooms = ""; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $nonAvailableRooms .="'". $row['Code'] ."',"; } if($nonAvailableRooms == "") { ShowAllRooms(); } else { Codes($nonAvailableRooms); } echo mysql_error(); } function Codes($findedCodes){ $findedCodes = substr($findedCodes, 0, -1); $query = "SELECT (Code),Description,Notes FROM Item WHERE code NOT IN ($findedCodes)"; $result = mysql_query($query); $i = 0; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $i++; echo "<div style='border:1px solid black'><a title=\"".$row['Notes']." href=\"rooms/".$row['Code'].".jpg\"><img height=120px width=140px src=\"rooms/".$row['Code'].".jpg\" border=0></a>"; echo "<br/>Room Code :{$row['Code']} <br> Room Description : {$row['Description']} <br/> <input id='chk_$i' type='checkbox' name='option$i' onclick='showValue(this);' value='{$row['Code']}'><br> Book this room. </div>" ; } if($i == 0){ echo "There is no available rooms."; } else { header('index.php?name=Next'); } } function ShowAllRooms() { $query = "SELECT * FROM item"; $result = mysql_query($query); $i = 0; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $i++; echo "<div style='border:1px solid black'><a href=\"rooms/".$row['Code'].".jpg\"><img height=120px width=140px src=\"rooms/".$row['Code'].".jpg\" border=0></a>"; echo "<br/>Room Code :{$row['Code']} <br> Room Description : {$row['Description']} <br/><input id='chk_$i' type='checkbox' name='option$i' onclick='showValue(this);' value='{$row['Code']}'>Book this room.<br> </div>" ; } header('index.php?name=Next'); } //Step 2 the code to run after dates is valid ?> So when all is validated i want the button to chage uri to header('index.php?name=Next'); and then change button value to Next or $_SELF or some vairable that i can run to change button click procedure todo step 2 <input id="Submit" type="submit" name="submit" value="<?php ?>"/></div> Hope someone can help me Thanks
  5. Does anyone have a awnser
  6. $i = 0; while ($row = mysql_fetch_array( $result )) { $i++; switch($i) { case 0: $value1 = $row['Email']; break ; case 1: $value2 =$row['Email']; break; } }
  7. Try this "SELECT [Password] FROM [Members] WHERE [username] = '" & UsernameTextBox.Text & "'" for vb.net "SELECT [Password] FROM [Members] WHERE [username] = '" + UsernameTextBox.Text + "'" for C# Notice the single qoutes before the double qoutes that should work Also u should use Parameters . Better stuctured code and easy to find errors You have the chance of SQL Injection
  8. <img alt="" src="/images/myimg.jpg" onmouseover="this.style.width = 300px;this.style.height =300px;" onmouseout="this.style.width=;"> Something like this to resize images Cheers
  9. if(yourelement == null) { //logic here } else { //Not equal to Empty }
  10. You need to save your listbox infomation in a database like MSSQL .. Then when you read your data something like this Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)_ Handles MyBase.Load myConnection = New SqlConnection("server=localhost;uid=sa;pwd=;database=pubs") 'establishing connection. you need to provide password for sql server Try myConnection.Open() 'opening the connection myCommand = New SqlCommand("Select price from discounts", myConnection) 'executing the command and assigning it to connection dr = myCommand.ExecuteReader() While dr.Read() ListBox1.Items.Add(dr("price").ToString()) 'displaying the data from the table End While dr.Close() myConnection.Close() Catch e As Exception End Try End Sub 'Then is you get a update save it to the database then retrieve it
  11. Well nothing happened the uri stayed the same here is my code header('Location:index.php?name=Next'); What i want to do is pass that next value into my button value but the uri did not change Thanks
  12. Hi all I'm new to PHP so i might ask easy stuff Here is my Scenario I click a button .. this work fine But in the php code that runs after the button is clicked i need to change the Website uri (link) to something like this after button postback index?name=value How am i gonna do this . I tried header function but it did not work well Any suggestion please
  13. Ok it works without an error . But i am trying to set a button value to my session like so <input id="Submit" type="submit" name="submit" value="<?php echo $_SESSION['txt']; ?>"/></div> But the debugger still skips this line if(isset($_SESSION['txt'])){//When is step through the code it goes to else telling me it is not set . Maybe isset is lost after postback is there maybe a better way to do this or should i use it as a session is the only thing that remain after postback
  14. Nope there is still a problem I set my session like this <?php { if(isset($_SESSION['txt'])){//When is step through the code it goes to else telling me it is not set . $_SESSION['txt'] = "Next >"; echo $_SESSION['txt']; } else { $_SESSION['txt'] = "Check Available"; echo $_SESSION['txt']; } } ?> "/> But when i debug my code it tells me my session is not set And if i use session_start(); i get the following error Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\xampp\htdocs\OnlineBookingsPhp\index.php:199) in C:\Program Files\xampp\htdocs\OnlineBookingsPhp\index.php on line 210 Call Stack #TimeMemoryFunctionLocation 10.2265381640{main}( )..\index.php:0 24.1850394048session_start ( )..\index.php:210 Any ideas ???
  15. Thanks for the quick response ... it looks like it worked !
×
×
  • 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.